/* Villaggio Maori Shop - Frontend CSS */

/* Variabili */
:root {
    --vm-primary: #000000;
    --vm-secondary: #666666;
    --vm-accent: #f5f5f5;
    --vm-border: #e0e0e0;
    --vm-success: #4caf50;
    --vm-error: #f44336;
    --vm-text: #333333;
    --vm-text-light: #777777;
}

/* Reset e Base */
.vm-catalog,
.vm-cart-page,
.vm-checkout-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--vm-text);
    line-height: 1.6;
}

/* Catalogo - Griglia Libri */
.vm-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.vm-book-card {
    background: #fff;
    border: 1px solid var(--vm-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.vm-book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.vm-book-image {
    width: 100%;
    height: auto;
    overflow: visible;
    background: var(--vm-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.vm-book-image img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    display: block;
}

.vm-book-details {
    padding: 20px;
}

.vm-book-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--vm-primary);
}

.vm-book-author {
    font-size: 14px;
    color: var(--vm-secondary);
    margin: 0 0 8px 0;
}

.vm-book-isbn {
    font-size: 12px;
    color: var(--vm-text-light);
    margin: 0 0 10px 0;
}

.vm-book-description {
    font-size: 14px;
    color: var(--vm-text);
    margin: 10px 0;
}

.vm-book-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--vm-border);
}

.vm-book-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--vm-primary);
}

/* Pulsanti */
.vm-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0;
}

.vm-btn-primary {
    background: var(--vm-primary);
    color: #fff;
}

.vm-btn-primary:hover {
    background: var(--vm-secondary);
}

.vm-btn-secondary {
    background: var(--vm-accent);
    color: var(--vm-primary);
    border: 1px solid var(--vm-border);
}

.vm-btn-secondary:hover {
    background: var(--vm-primary);
    color: #fff;
}

.vm-btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.vm-btn-block {
    display: block;
    width: 100%;
}

.vm-add-to-cart-btn {
    background: var(--vm-primary);
    color: #fff;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.3s ease;
}

.vm-add-to-cart-btn:hover {
    background: var(--vm-secondary);
}

/* Widget Carrello */
.vm-cart-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.vm-cart-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--vm-primary);
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    position: relative;
    transition: transform 0.3s ease;
}

.vm-cart-link:hover {
    transform: scale(1.1);
}

.vm-cart-icon {
    font-size: 24px;
}

.vm-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--vm-error);
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

/* Pagina Carrello */
.vm-cart-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.vm-cart-page h2 {
    font-size: 32px;
    margin-bottom: 30px;
    color: var(--vm-primary);
}

.vm-cart-table-wrap {
    overflow-x: auto;
    margin-bottom: 30px;
}

.vm-cart-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.vm-cart-table th {
    background: var(--vm-accent);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--vm-border);
}

.vm-cart-table td {
    padding: 20px 15px;
    border-bottom: 1px solid var(--vm-border);
}

.vm-cart-item-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.vm-cart-item-image {
    width: 60px;
    height: 80px;
    object-fit: cover;
}

.vm-quantity-input {
    width: 70px;
    padding: 8px;
    border: 1px solid var(--vm-border);
    text-align: center;
    font-size: 14px;
}

.vm-remove-item-btn {
    background: none;
    border: none;
    color: var(--vm-error);
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.vm-remove-item-btn:hover {
    transform: scale(1.2);
}

.vm-cart-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 40px;
}

.vm-discount-code,
.vm-cart-totals {
    background: #fff;
    padding: 30px;
    border: 1px solid var(--vm-border);
}

.vm-discount-code h3,
.vm-cart-totals h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--vm-primary);
}

.vm-discount-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.vm-discount-form input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--vm-border);
    font-size: 14px;
}

.vm-discount-applied {
    padding: 15px;
    background: var(--vm-accent);
    border: 1px solid var(--vm-border);
    margin-top: 15px;
}

.vm-btn-link {
    background: none;
    border: none;
    color: var(--vm-error);
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
}

.vm-totals-table {
    width: 100%;
    margin-bottom: 20px;
}

.vm-totals-table tr {
    border-bottom: 1px solid var(--vm-border);
}

.vm-totals-table td {
    padding: 12px 0;
}

.vm-totals-table td:last-child {
    text-align: right;
}

.vm-total-row {
    border-top: 2px solid var(--vm-primary) !important;
    font-size: 18px;
}

/* Pagina Checkout */
.vm-checkout-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.vm-checkout-page h2 {
    font-size: 32px;
    margin-bottom: 30px;
    color: var(--vm-primary);
}

.vm-checkout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.vm-checkout-section h3,
.vm-checkout-sidebar h3 {
    font-size: 20px;
    margin: 30px 0 20px 0;
    color: var(--vm-primary);
    border-bottom: 2px solid var(--vm-primary);
    padding-bottom: 10px;
}

.vm-checkout-section h3:first-child {
    margin-top: 0;
}

.vm-form-group {
    margin-bottom: 20px;
}

.vm-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.vm-form-group input[type="text"],
.vm-form-group input[type="email"],
.vm-form-group input[type="tel"],
.vm-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--vm-border);
    font-size: 14px;
    font-family: inherit;
}

.vm-form-group textarea {
    resize: vertical;
}

.vm-shipping-option,
.vm-payment-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
    border: 1px solid var(--vm-border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.vm-shipping-option:hover,
.vm-payment-option:hover {
    background: var(--vm-accent);
}

.vm-shipping-option input,
.vm-payment-option input {
    margin-top: 4px;
}

.vm-checkout-sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.vm-order-review {
    background: #fff;
    border: 1px solid var(--vm-border);
    padding: 20px;
    margin-bottom: 20px;
}

.vm-order-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
    padding: 15px 0;
    border-bottom: 1px solid var(--vm-border);
    font-size: 14px;
}

.vm-order-item:last-child {
    border-bottom: none;
}

.vm-order-item-qty {
    color: var(--vm-secondary);
}

.vm-order-item-total {
    text-align: right;
    font-weight: 600;
}

.vm-order-totals {
    background: var(--vm-accent);
    padding: 20px;
    margin-bottom: 20px;
}

.vm-order-totals table {
    width: 100%;
}

.vm-order-totals tr {
    border-bottom: 1px solid var(--vm-border);
}

.vm-order-totals td {
    padding: 12px 0;
}

.vm-order-totals td:last-child {
    text-align: right;
}

/* Notifiche */
.vm-notice {
    padding: 15px 20px;
    margin: 20px 0;
    border-left: 4px solid;
}

.vm-notice-info {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #0d47a1;
}

.vm-notice-success {
    background: #e8f5e9;
    border-color: var(--vm-success);
    color: #1b5e20;
}

.vm-notice-error {
    background: #ffebee;
    border-color: var(--vm-error);
    color: #b71c1c;
}

/* Responsive */
@media (max-width: 768px) {
    .vm-books-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .vm-cart-actions {
        grid-template-columns: 1fr;
    }
    
    .vm-checkout-grid {
        grid-template-columns: 1fr;
    }
    
    .vm-checkout-sidebar {
        position: static;
    }
    
    .vm-cart-table {
        font-size: 14px;
    }
    
    .vm-cart-table th,
    .vm-cart-table td {
        padding: 10px;
    }
}

/* Caricamento */
.vm-loading {
    opacity: 0.6;
    pointer-events: none;
}

.vm-spinner {
    border: 3px solid var(--vm-accent);
    border-top: 3px solid var(--vm-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === PAGINA LIBRO SINGOLO === */
.vm-book-single {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.vm-book-cover-large {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: block !important;
    margin: 0 auto !important;
}

.vm-share-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.vm-share-section h4 {
    font-size: 18px;
    margin: 0 0 15px 0;
    color: #333;
}

.vm-share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.vm-share-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.vm-share-facebook {
    background: #1877f2;
    color: white;
}

.vm-share-facebook:hover {
    background: #145dbf;
}

.vm-share-twitter {
    background: #1da1f2;
    color: white;
}

.vm-share-twitter:hover {
    background: #1a8cd8;
}

.vm-share-email {
    background: #ea4335;
    color: white;
}

.vm-share-email:hover {
    background: #c23321;
}

.vm-share-copy {
    background: #34a853;
    color: white;
}

.vm-share-copy:hover {
    background: #2d8e47;
}

/* Checkout Summary Sidebar */
.vm-checkout-summary {
    background: #fff;
    border: 2px solid var(--vm-primary);
    padding: 25px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.vm-checkout-summary h3 {
    font-size: 20px;
    margin: 0 0 20px 0;
    color: var(--vm-primary);
    border-bottom: 2px solid var(--vm-primary);
    padding-bottom: 10px;
}

.vm-order-items {
    margin-bottom: 20px;
}

.vm-order-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--vm-border);
}

.vm-order-item:last-child {
    border-bottom: none;
}

.vm-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vm-item-info strong {
    font-size: 14px;
    color: var(--vm-text);
}

.vm-item-quantity {
    font-size: 13px;
    color: #666;
}

.vm-item-price {
    font-weight: 600;
    color: var(--vm-primary);
    white-space: nowrap;
}

.vm-order-totals {
    border-top: 2px solid var(--vm-border);
    padding-top: 15px;
}

.vm-total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.vm-discount-row {
    color: #d63031;
}

.vm-discount-amount {
    font-weight: 600;
}

.vm-total-final {
    border-top: 2px solid var(--vm-primary);
    margin-top: 10px;
    padding-top: 15px !important;
    font-size: 18px !important;
}

.vm-total-final strong {
    color: var(--vm-primary);
}

.vm-empty-cart {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

/* ========================================
   PREVENDITA - Badge e stili
   ======================================== */

/* Badge prevendita nel catalogo */
.vm-book-preorder-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
    z-index: 10;
}

/* Badge prevendita nella pagina singola */
.vm-preorder-badge {
    background: linear-gradient(135deg, #fff5f0, #fff0e6);
    border: 2px solid #ff6b35;
    border-radius: 8px;
    padding: 15px 20px;
    margin: 15px 0 20px;
}

.vm-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.vm-badge-preorder {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
}

.vm-preorder-date {
    display: block;
    margin-top: 10px;
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

.vm-preorder-message {
    margin: 10px 0 0;
    font-style: italic;
    color: #666;
    font-size: 14px;
}

/* Pulsante prenota */
.vm-add-to-cart-btn-large[data-preorder="true"],
.vm-add-to-cart-btn[data-preorder="true"] {
    background: linear-gradient(135deg, #ff6b35, #f7931e) !important;
}

.vm-add-to-cart-btn-large[data-preorder="true"]:hover,
.vm-add-to-cart-btn[data-preorder="true"]:hover {
    background: linear-gradient(135deg, #e55a2b, #e08418) !important;
}

/* Badge prevendita nel carrello */
.vm-cart-preorder-notice {
    background: #fff5f0;
    border: 1px solid #ff6b35;
    border-radius: 6px;
    padding: 12px 15px;
    margin: 10px 0;
    font-size: 14px;
    color: #c44d1c;
}

.vm-cart-preorder-notice strong {
    color: #ff6b35;
}

.vm-cart-item-preorder {
    font-size: 11px;
    color: #ff6b35;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 5px;
}
