/* Shop Layout Wrapper */
.kapiva-shop-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    align-items: start;
}

@media (max-width: 1024px) {
    .kapiva-shop-layout {
        grid-template-columns: 1fr;
        padding: 10px 5px;
        /* Reduced specific padding for mobile (User Request) */
    }

    .kapiva-shop-sidebar {
        display: none;
        /* Hide sidebar on mobile for now or make collapsible */
    }
}

/* Sidebar Widget Styling */
.kapiva-shop-sidebar .widget {
    margin-bottom: 30px;
    background: #fafafa;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
}

.kapiva-shop-sidebar .widget-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 15px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
}

.kapiva-shop-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kapiva-shop-sidebar li {
    margin-bottom: 10px;
    font-size: 14px;
    color: #444;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* PRODUCT GRID */
.woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    /* Force 3 columns */
    gap: 24px !important;
    margin: 0 !important;
}

@media (max-width: 768px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        /* 2 cols on mobile */
        gap: 15px !important;
    }
}

@media (max-width: 480px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        /* 2 cols on tiny screens (User Request) */
        gap: 10px !important;
    }
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
    display: none !important;
}

/* PRODUCT CARD STYLING */
.woocommerce ul.products li.product {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    /* Reset default padding */
    margin: 0 !important;
    /* Reset default margin */
    width: 100% !important;
    /* Reset default width */
}

.woocommerce ul.products li.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

/* Image Area */
.woocommerce ul.products li.product a img {
    width: 100%;
    height: 300px;
    /* Fixed height for uniformity */
    object-fit: cover;
    margin: 0 !important;
}

/* Card Content */
.kapiva-card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.kapiva-card-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    margin-bottom: 5px !important;
    line-height: 1.4 !important;
    min-height: 42px;
    /* 2 lines aprox */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kapiva-card-price {
    font-size: 18px;
    font-weight: 800;
    color: #000;
    margin-bottom: 15px;
}

.kapiva-card-price del {
    font-size: 12px;
    color: #999;
    font-weight: normal;
    margin-left: 5px;
}

/* Action Buttons */
.kapiva-card-actions {
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: 10px;
    margin-top: auto;
}

.kapiva-btn-cart {
    background: #333;
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    transition: background 0.2s;
    position: relative;
    /* For Quantity Badge */
}

.kapiva-btn-cart:hover {
    background: #000;
    color: #fff;
}

.kapiva-btn-buy {
    background: #849c3e;
    color: #fff;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    text-decoration: none;
    letter-spacing: 1px;
}

.kapiva-btn-buy:hover {
    background: #6f8531;
    color: #fff;
}

/* Pagination */
.woocommerce-pagination ul {
    display: flex;
    justify-content: center;
    gap: 10px;
    border: none !important;
    margin-top: 40px;
}

/* FIX: Hide WooCommerce 'View Cart' link that breaks the grid layout */
.kapiva-card-actions .added_to_cart {
    display: none !important;
}

/* OPTIONAL: Ensure Add to Cart button maintains shape when loading */
.kapiva-card-actions .loading {
    opacity: 0.7;
    pointer-events: none;
}

/* =========================================
   KAPIVA STYLE REVIEWS (SUMMARY + MODAL + GRID)
   ========================================= */

/* A. REVIEW SUMMARY & DASHBOARD */
.kapiva-review-dashboard {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding-bottom: 40px;
    margin-bottom: 40px;
}

.kapiva-big-score {
    font-size: 64px;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1;
}

.kapiva-progress-bar-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
    font-weight: bold;
}

.kapiva-progress-bg {
    flex: 1;
    height: 6px;
    background: #e5e5e5;
    border-radius: 3px;
    overflow: hidden;
}

.kapiva-progress-fill {
    height: 100%;
    background: #849c3e;
    /* Primary Green */
    border-radius: 3px;
}

/* B. REVIEWS GRID */
#reviews .commentlist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    padding: 0;
    list-style: none;
}

#reviews .commentlist li.review {
    background: #fff;
    border: 1px solid #e5e5e5;
    padding: 24px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
    position: relative;
    /* Boxy approach */
}

/* Custom Review Card Layout */
.k-review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.k-review-author {
    font-weight: 800;
    font-size: 14px;
    color: #1a1a1a;
    display: block;
}

.k-review-date {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    font-weight: bold;
}

.k-review-title {
    font-weight: 800;
    font-size: 16px;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.3;
}

.k-review-body {
    font-size: 14px;
    color: #444;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* C. REVIEW MODAL (Hidden by default) */
#kapiva-review-modal {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#kapiva-review-modal.open {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Modal Content Animation */
#kapiva-review-modal .modal-content {
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#kapiva-review-modal.open .modal-content {
    transform: scale(1);
}

/* Star Rating Input in Modal */
.star-rating-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 5px;
}

.star-rating-input input {
    display: none;
}

.star-rating-input label {
    cursor: pointer;
    color: #ddd;
    font-size: 32px;
    transition: color 0.2s;
}

.star-rating-input label:hover,
.star-rating-input label:hover~label,
.star-rating-input input:checked~label {
    color: #849c3e;
    /* Active Color */
}

/* File Upload Zone */
.file-upload-zone {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    /* Reduced from 30px */
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-upload-zone:hover {
    border-color: #849c3e;
    background: #f9fbf0;
}