/* examsboard/static/css/shop.css */

/* --- SHOP LAYOUT (List View) --- */
.shop-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 40px;
    padding: 40px 5%;
    max-width: 1400px;
    margin: 0 auto;
    align-items: start;
}

/* Sidebar / Filters */
.shop-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    position: sticky;
    top: 100px;
    z-index: 10;
}

.filter-group { margin-bottom: 30px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-title { 
    font-size: 1rem; 
    font-weight: 700; 
    margin-bottom: 15px; 
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
    color: var(--text-main);
}

.category-list li { margin-bottom: 10px; }
.category-link {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: var(--transition);
    padding: 5px 0;
}
.category-link:hover, .category-link.active {
    color: var(--primary);
    transform: translateX(5px);
}
.category-count {
    background: var(--bg-body);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Shop Header (Search & Sort) */
.shop-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}
.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}
.search-box input {
    width: 100%;
    padding: 12px 20px;
    padding-right: 45px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: var(--bg-card);
    color: var(--text-main);
}
.search-box button {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-thumb {
    position: relative;
    height: 220px;
    background: #f1f5f9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-thumb img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.product-card:hover .product-thumb img { transform: scale(1.05); }

.badge-sale {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--secondary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    z-index: 2;
}

.product-info { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.product-category { font-size: 0.75rem; color: var(--accent-pink); text-transform: uppercase; font-weight: 700; margin-bottom: 5px; }
.product-title { 
    font-size: 1.05rem; 
    font-weight: 700; 
    margin-bottom: 10px; 
    line-height: 1.4; 
    flex: 1; 
}
.product-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.product-meta i { margin-right: 5px; color: var(--primary); }

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 15px;
    margin-top: auto;
}
.price-tag { font-weight: 800; color: var(--text-main); font-size: 1.1rem; }
.price-tag .old { 
    text-decoration: line-through; 
    color: var(--text-muted); 
    font-size: 0.85rem; 
    margin-right: 5px; 
    font-weight: 400;
}
.btn-view {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
}
.btn-view:hover { text-decoration: underline; }

/* Pagination */
.pagination {
    margin-top: 50px;
    display: flex;
    justify-content: center;
    gap: 10px;
}
.page-link {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    transition: var(--transition);
}
.page-link.active, .page-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* --- PRODUCT DETAIL PAGE --- */
.product-detail-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 50px;
}
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.detail-image {
    background: #f8fafc;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border);
}
.detail-image img {
    box-shadow: var(--shadow-lg);
    max-height: 500px;
    border-radius: 8px;
    max-width: 100%;
}
.detail-content { padding: 40px; }
.detail-header { margin-bottom: 25px; border-bottom: 1px solid var(--border); padding-bottom: 25px; }
.detail-title { font-size: 2rem; margin-bottom: 10px; line-height: 1.2; }
.detail-price { font-size: 1.8rem; color: var(--primary); font-weight: 800; }

.detail-features { margin: 25px 0; }
.feature-item {
    display: flex;
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.feature-label { width: 140px; font-weight: 600; color: var(--text-main); }

.detail-actions { margin-top: 30px; }
.btn-buy {
    display: block;
    width: 100%;
    background: var(--accent-green);
    color: white;
    text-align: center;
    padding: 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}
.btn-buy:hover { background: #059669; transform: translateY(-2px); }

/* --- CHECKOUT & FORMS --- */
.checkout-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}
.checkout-form-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; }
.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-body);
    font-family: inherit;
    transition: var(--transition);
}
.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.payment-methods {
    display: grid;
    gap: 15px;
    margin-top: 10px;
}
.payment-radio {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}
.payment-radio:hover, .payment-radio.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}
.payment-radio input { margin-right: 12px; }

/* Order Summary */
.order-summary {
    background: #f8fafc;
    padding: 30px;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    height: fit-content;
    width: 100%; /* Ensures it fills container */
}
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 0.95rem;
    color: #1e293b;
}
.summary-total {
    border-top: 2px solid var(--border);
    padding-top: 15px;
    margin-top: 15px;
    font-weight: 800;
    font-size: 1.2rem;
    color: #1e293b;
}

/* Success Page */
.success-container {
    text-align: center;
    max-width: 600px;
    margin: 60px auto;
    background: var(--bg-card);
    padding: 50px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.success-icon {
    width: 80px; height: 80px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 25px auto;
}

/* --- UTILITIES --- */
/* Add this class to your table wrapper in HTML */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
    margin-bottom: 15px;
    display: block;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 992px) {
    /* 1. Layout Stacking */
    .shop-container, 
    .detail-grid { 
        grid-template-columns: 1fr; 
        gap: 30px;
    }
    
    /* 2. Sidebar Adjustments */
    .shop-sidebar { 
        margin-bottom: 30px; 
        position: relative; 
        top: 0;
        z-index: 1;
    }

    /* 3. Checkout/Cart Grid Stacking */
    .checkout-grid { 
        grid-template-columns: 1fr;
        display: flex; 
        flex-direction: column;
        gap: 30px;
    }

    /* 4. Fix Grid Children Widths (Crucial for Table Scroll) */
    .checkout-grid > div {
        width: 100%;
        min-width: 0; 
    }

    /* 5. Mobile Order Logic (Optional: Adjust based on preference) */
    /* This puts the summary ON TOP of the cart/form. 
       If you want Summary BELOW, remove the 'order: -1' line below. */
    .checkout-grid > div:nth-child(2) { 
        order: -1; 
    }
    
    /* 6. Form Padding Adjustment */
    .checkout-form-card,
    .order-summary,
    .product-info,
    .detail-content,
    .detail-image {
        padding: 20px;
    }
}

/* --- PRODUCT DESCRIPTION TEXT FORMATTING --- */
/* This fixes the spacing issues for content coming from CKEditor */

.product-description-content,
.post-content {
    font-size: 1rem;
    color: var(--text-main);
}

.product-description-content p,
.post-content p {
    margin-bottom: 1.5rem; /* Adds space between paragraphs */
    line-height: 1.75;     /* Improves readability */
}

.product-description-content p:last-child,
.post-content p:last-child {
    margin-bottom: 0;      /* Removes extra space after the last paragraph */
}

.product-description-content h2, 
.product-description-content h3,
.post-content h2, 
.post-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.product-description-content ul, 
.product-description-content ol,
.post-content ul, 
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.product-description-content li,
.post-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.product-description-content strong,
.post-content strong {
    font-weight: 700;
    color: var(--text-main);
}

.product-description-content a,
.post-content a {
    color: var(--primary);
    text-decoration: underline;
}

/* --- PRODUCT DESCRIPTION TEXT FORMATTING --- */
.product-description-content,
.post-content {
    font-size: 1rem;
    color: var(--text-main);
}

.product-description-content p,
.post-content p {
    margin-bottom: 1.5rem;
    line-height: 1.75;
}

/* --- BULLET POINTS & LISTS --- */
.product-description-content ul, 
.post-content ul {
    list-style-type: disc;       /* Ensures bullets are visible */
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;        /* Indents the bullets from the left */
    margin-left: 10px;           /* Extra visual separation */
}

.product-description-content ol, 
.post-content ol {
    list-style-type: decimal;    /* Numbers for ordered lists */
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    margin-left: 10px;
}

.product-description-content li,
.post-content li {
    margin-bottom: 0.5rem;       /* Space between individual list items */
    line-height: 1.6;
    padding-left: 5px;           /* Space between bullet and text */
}

/* Headers inside descriptions */
.product-description-content h2, 
.product-description-content h3,
.post-content h2, 
.post-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.product-description-content strong,
.post-content strong {
    font-weight: 700;
    color: var(--text-main);
}

.product-description-content a,
.post-content a {
    color: var(--primary);
    text-decoration: underline;
}