/**
 * Vanilla Shop - Frontend CSS
 */

/* Reset e base */
.vanilla-shop-container,
.vanilla-shop-shortcode,
.vanilla-product-detail-shortcode {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #333;
}

.vanilla-shop-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.shop-header h1 {
    font-size: 32px;
    margin: 0;
    color: #23282d;
}

.user-wallet-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 16px;
}

.wallet-icon {
    font-size: 24px;
}

.wallet-balance strong {
    font-size: 18px;
}

.login-prompt .btn-login {
    background: #0073aa;
    color: #fff;
    padding: 10px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s;
}

.login-prompt .btn-login:hover {
    background: #005a87;
}

/* Banner utente */
.user-wallet-banner,
.login-banner {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

.login-banner a {
    color: #0073aa;
    font-weight: 600;
}

/* Grid prodotti */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.products-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.products-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Card prodotto */
.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.product-image {
    position: relative;
    padding-top: 75%;
    background: #f5f5f5;
    overflow: hidden;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image-placeholder .placeholder-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    opacity: 0.5;
}

.product-info {
    padding: 20px;
}

.product-name {
    font-size: 18px;
    margin: 0 0 10px;
    line-height: 1.3;
}

.product-name a {
    color: #23282d;
    text-decoration: none;
    transition: color 0.3s;
}

.product-name a:hover {
    color: #0073aa;
}

.product-description {
    color: #666;
    font-size: 14px;
    margin: 0 0 15px;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.product-price {
    font-size: 22px;
    font-weight: 700;
    color: #0073aa;
}

.btn-view-product {
    background: #0073aa;
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-view-product:hover {
    background: #005a87;
    color: #fff;
}

/* Pagina dettaglio prodotto */
.product-detail-container {
    padding-top: 20px;
}

.breadcrumb {
    margin-bottom: 25px;
    font-size: 14px;
    color: #666;
}

.breadcrumb a {
    color: #0073aa;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    margin: 0 8px;
    color: #999;
}

.breadcrumb .current {
    color: #333;
}

.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.product-main-image {
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-main-image .placeholder-icon {
    font-size: 80px;
    opacity: 0.4;
}

.product-title {
    font-size: 28px;
    margin: 0 0 20px;
    color: #23282d;
}

.product-price-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.price-label {
    font-size: 14px;
    color: #666;
    display: block;
    margin-bottom: 5px;
}

.price-value {
    font-size: 36px;
    font-weight: 700;
    color: #0073aa;
}

.product-details .product-description {
    margin-bottom: 25px;
}

.product-details .product-description h3 {
    font-size: 16px;
    margin: 0 0 10px;
    color: #23282d;
}

/* Box acquisto */
.purchase-box,
.login-required-box,
.insufficient-funds-box {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.wallet-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.wallet-label {
    color: #666;
}

.wallet-value {
    font-size: 20px;
    font-weight: 600;
}

.wallet-value.sufficient {
    color: #28a745;
}

.wallet-value.insufficient {
    color: #dc3545;
}

.quantity-selector {
    margin-bottom: 20px;
}

.quantity-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.quantity-selector input {
    width: 80px;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-purchase {
    width: 100%;
    padding: 15px;
    font-size: 18px;
}

.btn-purchase:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.purchase-note {
    font-size: 13px;
    color: #666;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 0;
}

/* Login required box */
.login-required-box {
    text-align: center;
}

.login-required-box p {
    margin-bottom: 20px;
    color: #666;
}

.login-required-box .btn {
    margin: 0 10px;
}

/* Insufficient funds */
.insufficient-funds-box {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

.insufficient-funds-box .error-message {
    color: #856404;
    margin: 0 0 10px;
}

.insufficient-funds-box .funds-needed {
    font-weight: 600;
    color: #dc3545;
    margin: 0 0 15px;
}

/* Product unavailable */
.product-unavailable {
    margin-bottom: 20px;
}

.unavailable-badge {
    display: inline-block;
    background: #dc3545;
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 500;
}

/* Product meta */
.product-meta {
    font-size: 14px;
    color: #666;
}

.meta-label {
    font-weight: 600;
}

/* Bottom actions */
.product-actions-bottom {
    margin-top: 30px;
}

.btn-back {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.btn-back:hover {
    text-decoration: underline;
}

/* Shop footer */
.shop-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-back-home {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.btn-back-home:hover {
    text-decoration: underline;
}

/* No products */
.no-products {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.no-products p {
    font-size: 18px;
    color: #666;
    margin: 0;
}

/* Modals */
.vanilla-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 30px 25px;
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: #28a745;
    color: #fff;
    font-size: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.error-icon {
    width: 80px;
    height: 80px;
    background: #dc3545;
    color: #fff;
    font-size: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.success-message {
    font-size: 16px;
    color: #333;
    margin: 0 0 15px;
}

.new-balance-info {
    font-size: 18px;
    color: #666;
    margin: 0;
}

.new-balance-value {
    color: #28a745;
}

.modal-footer {
    padding: 20px 25px;
    background: #f8f9fa;
    text-align: center;
}

.modal-footer .btn {
    min-width: 150px;
}

/* Responsive */
@media screen and (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-detail {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

@media screen and (max-width: 600px) {
    .shop-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-title {
        font-size: 22px;
    }

    .price-value {
        font-size: 28px;
    }

    .login-required-box .btn {
        display: block;
        margin: 10px 0;
    }
}