/**
 * Serva Theme - WooCommerce Styles
 *
 * @package Serva
 * @since 1.0.0
 */

/* ========================================
   Shop Page
   ======================================== */

.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce ul.products li.product {
    margin: 0;
    padding: 0;
    width: 100% !important;
}

/* ========================================
   Result Count & Ordering
   ======================================== */

.woocommerce-result-count {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.woocommerce-ordering select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: white;
    font-size: 0.875rem;
    cursor: pointer;
}

/* ========================================
   Pagination
   ======================================== */

.woocommerce nav.woocommerce-pagination {
    margin-top: 2rem;
    text-align: center;
}

.woocommerce nav.woocommerce-pagination ul {
    display: inline-flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce nav.woocommerce-pagination ul li {
    margin: 0;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: white;
    color: #374151;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.woocommerce nav.woocommerce-pagination ul li a:hover {
    border-color: var(--serva-primary, #3b82f6);
    color: var(--serva-primary, #3b82f6);
}

.woocommerce nav.woocommerce-pagination ul li span.current {
    background-color: var(--serva-primary, #3b82f6);
    border-color: var(--serva-primary, #3b82f6);
    color: white;
}

/* ========================================
   Single Product
   ======================================== */

.woocommerce div.product .product_title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
}

.woocommerce div.product p.price {
    font-size: 1.5rem;
    color: var(--serva-primary, #3b82f6);
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.woocommerce div.product p.price del {
    color: #9ca3af;
    font-size: 1rem;
    font-weight: 400;
}

.woocommerce div.product p.price ins {
    text-decoration: none;
}

/* Add to Cart Button */
.woocommerce div.product form.cart {
    margin-bottom: 1.5rem;
}

.woocommerce div.product form.cart .quantity {
    margin-left: 1rem;
}

.woocommerce div.product form.cart button.single_add_to_cart_button {
    background-color: var(--serva-primary, #3b82f6);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.woocommerce div.product form.cart button.single_add_to_cart_button:hover {
    background-color: var(--serva-primary-dark, #2563eb);
}

/* Product Meta */
.woocommerce div.product .product_meta {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.woocommerce div.product .product_meta > span {
    display: block;
    margin-bottom: 0.5rem;
}

.woocommerce div.product .product_meta a {
    color: var(--serva-primary, #3b82f6);
}

/* ========================================
   Product Tabs
   ======================================== */

.woocommerce div.product .woocommerce-tabs {
    margin-top: 2rem;
}

.woocommerce div.product .woocommerce-tabs ul.tabs {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li {
    margin: 0;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li a {
    display: block;
    padding: 1rem 1.5rem;
    color: #6b7280;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li.active a,
.woocommerce div.product .woocommerce-tabs ul.tabs li a:hover {
    color: var(--serva-primary, #3b82f6);
    border-bottom-color: var(--serva-primary, #3b82f6);
}

.woocommerce div.product .woocommerce-tabs .panel {
    background-color: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

/* ========================================
   Related Products
   ======================================== */

.woocommerce .related.products,
.woocommerce .upsells.products,
.woocommerce .cross-sells {
    margin-top: 3rem;
}

.woocommerce .related.products > h2,
.woocommerce .upsells.products > h2,
.woocommerce .cross-sells > h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

/* ========================================
   Cart Page
   ======================================== */

.woocommerce-cart table.cart {
    width: 100%;
    border-collapse: collapse;
}

.woocommerce-cart table.cart th,
.woocommerce-cart table.cart td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: right;
}

.woocommerce-cart table.cart th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.woocommerce-cart table.cart .product-thumbnail img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.woocommerce-cart table.cart .product-name a {
    color: #1f2937;
    font-weight: 500;
}

.woocommerce-cart table.cart .product-name a:hover {
    color: var(--serva-primary, #3b82f6);
}

.woocommerce-cart table.cart .product-remove a {
    color: #ef4444;
    font-size: 1.25rem;
}

/* ========================================
   Checkout Page
   ======================================== */

.woocommerce form.checkout .form-row {
    margin-bottom: 1rem;
}

.woocommerce form.checkout .form-row label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.woocommerce form.checkout .form-row input.input-text,
.woocommerce form.checkout .form-row textarea,
.woocommerce form.checkout .form-row select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.woocommerce form.checkout .form-row input.input-text:focus,
.woocommerce form.checkout .form-row textarea:focus,
.woocommerce form.checkout .form-row select:focus {
    border-color: var(--serva-primary, #3b82f6);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Order Review */
.woocommerce-checkout-review-order-table {
    width: 100%;
    border-collapse: collapse;
}

.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}

/* Place Order Button */
#place_order {
    width: 100%;
    background-color: var(--serva-primary, #3b82f6);
    color: white;
    padding: 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#place_order:hover {
    background-color: var(--serva-primary-dark, #2563eb);
}

/* ========================================
   My Account
   ======================================== */

.woocommerce-MyAccount-navigation {
    margin-bottom: 2rem;
}

.woocommerce-MyAccount-navigation ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce-MyAccount-navigation ul li {
    margin: 0;
}

.woocommerce-MyAccount-navigation ul li a {
    display: block;
    padding: 0.75rem 1.25rem;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #374151;
    font-weight: 500;
    transition: all 0.3s ease;
}

.woocommerce-MyAccount-navigation ul li.is-active a,
.woocommerce-MyAccount-navigation ul li a:hover {
    background-color: var(--serva-primary, #3b82f6);
    border-color: var(--serva-primary, #3b82f6);
    color: white;
}

/* Orders Table */
.woocommerce-orders-table {
    width: 100%;
    border-collapse: collapse;
}

.woocommerce-orders-table th,
.woocommerce-orders-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: right;
}

.woocommerce-orders-table th {
    background-color: #f9fafb;
    font-weight: 600;
}

/* ========================================
   Reviews
   ======================================== */

.woocommerce #reviews #comments {
    margin-bottom: 2rem;
}

.woocommerce #reviews #comments ol.commentlist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce #reviews #comments ol.commentlist li {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.woocommerce #reviews #comments ol.commentlist li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.woocommerce #reviews #comments ol.commentlist li .comment-text {
    margin-right: 0;
    border: none;
    padding: 0;
}

.woocommerce #reviews #comments ol.commentlist li img.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    float: right;
    margin-left: 1rem;
}

.woocommerce #reviews #comments ol.commentlist li .meta {
    margin-bottom: 0.5rem;
}

.woocommerce #reviews #comments ol.commentlist li .meta strong {
    font-weight: 600;
    color: #1f2937;
}

.woocommerce #reviews #comments ol.commentlist li .meta time {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Review Form */
.woocommerce #review_form #respond {
    background-color: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.75rem;
}

.woocommerce #review_form #respond .comment-form-rating {
    margin-bottom: 1rem;
}

.woocommerce #review_form #respond .comment-form-rating label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.woocommerce #review_form #respond .stars {
    display: flex;
    gap: 0.25rem;
}

.woocommerce #review_form #respond .stars a {
    color: #d1d5db;
    font-size: 1.25rem;
}

.woocommerce #review_form #respond .stars a:hover,
.woocommerce #review_form #respond .stars a.active {
    color: #fbbf24;
}

/* ========================================
   Product Card Styles
   ======================================== */

/* Common Product Card Styles */
.product-card {
    position: relative;
}

.product-card .woocommerce-Price-amount {
    font-weight: 700;
}

.product-card del .woocommerce-Price-amount {
    font-weight: 400;
    color: #9ca3af;
}

/* Loading state for AJAX add to cart */
.product-card .add_to_cart_button.loading {
    opacity: 0.7;
    pointer-events: none;
}

.product-card .add_to_cart_button.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.product-card .add_to_cart_button.loading i {
    display: none;
}

.product-card .add_to_cart_button.added::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

.product-card .add_to_cart_button.added i {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ----------------------------------------
   Style 1: Classic Card
   ---------------------------------------- */
.product-card-classic {
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.product-card-classic:hover {
    border-color: #e5e7eb;
}

.product-card-classic .woocommerce-Price-amount {
    color: var(--serva-primary, #3b82f6);
}

/* ----------------------------------------
   Style 2: Modern Card
   ---------------------------------------- */
.product-card-modern {
    border: none;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.product-card-modern:hover {
    transform: translateY(-4px);
}

.product-card-modern .woocommerce-Price-amount {
    color: var(--serva-primary, #3b82f6);
    font-size: 1.125rem;
}

.product-card-modern .product-category a {
    color: #9ca3af;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ----------------------------------------
   Style 3: Minimal Card
   ---------------------------------------- */
.product-card-minimal {
    border: none;
    background: transparent;
}

.product-card-minimal:hover {
    background: white;
}

.product-card-minimal .woocommerce-Price-amount {
    color: #1f2937;
}

.product-card-minimal:hover .woocommerce-Price-amount {
    color: var(--serva-primary, #3b82f6);
}

/* ========================================
   Quick View Modal
   ======================================== */
.serva-quick-view-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.serva-quick-view-modal.active {
    opacity: 1;
    visibility: visible;
}

.serva-quick-view-modal .modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.serva-quick-view-modal.active .modal-content {
    transform: scale(1);
}

.serva-quick-view-modal .modal-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.serva-quick-view-modal .modal-close:hover {
    background: #f3f4f6;
}

/* ========================================
   Wishlist Button States
   ======================================== */
.serva-wishlist-btn.active,
.serva-wishlist-btn:hover {
    color: #ef4444;
}

.serva-wishlist-btn.active i::before {
    font-weight: 900;
}

/* ========================================
   Product Grid Layouts by Card Style
   ======================================== */

/* Classic style - 4 columns default */
.product-style-classic ul.products {
    grid-template-columns: repeat(4, 1fr);
}

/* Modern style - 3 columns for larger cards */
.product-style-modern ul.products {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

/* Minimal style - 5 columns for compact layout */
.product-style-minimal ul.products {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1280px) {
    .product-style-classic ul.products {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .product-style-modern ul.products {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product-style-minimal ul.products {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .product-style-classic ul.products,
    .product-style-modern ul.products,
    .product-style-minimal ul.products {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .woocommerce-cart table.cart .product-thumbnail {
        display: none;
    }
    
    .woocommerce-MyAccount-navigation ul {
        flex-direction: column;
    }
    
    /* Modern card adjustments for mobile */
    .product-card-modern .add_to_cart_button {
        font-size: 0.875rem;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .woocommerce ul.products,
    .product-style-classic ul.products,
    .product-style-modern ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .product-style-minimal ul.products {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product-card-classic,
    .product-card-modern {
        border-radius: 0.75rem;
    }
    
    .product-card-classic .p-4,
    .product-card-modern .p-5 {
        padding: 0.75rem;
    }
    
    .product-card-modern:hover {
        transform: none;
    }
}

