/* ==========================================================================
   JAGDISH OPTICALS - MASTER ARCHITECTURAL MODERN WORKSPACE
   COMPLETELY REDESIGNED LUXURY EDITORIAL LIGHT SYSTEM (ZERO BENTO ELEMENTS)
   ========================================================================== */

:root {
    /* Sophisticated Luxury Light Palette */
    --bg-color: #FAF9F5;           /* Warm Alabaster Linen */
    --card-bg: #FFFFFF;            /* Pure Studio White */
    
    --text-main: #1C1A17;          /* Premium Obsidian Charcoal */
    --text-muted: #7A7870;         /* Muted Warm Sandstone */
    --text-on-accent: #FFFFFF;     /* Bright High Contrast White */
    
    /* Luxury Atelier Accents: Antique Gold & Matte Obsidian Black */
    --accent: #1C1A17;             /* Bold Obsidian Frame Black */
    --accent-glow: rgba(28, 26, 23, 0.05);
    
    --gold: #A88F61;               /* Burnished Champagne Gold */
    --gold-hover: #8F764A;         /* Rich Antique Gold */
    --gold-glow: rgba(168, 143, 97, 0.12);
    
    --success: #2E5C47;            /* Quiet Muted Pine Green */
    --danger: #9B2D2D;             /* Editorial Burgundy Crimson */
    --danger-hover: #802323;
    
    /* Fine-Line Geometry and Borders */
    --radius: 12px;                /* Tailored architectural corners */
    --radius-sm: 8px;              /* Tactile controls corners */
    --radius-round: 980px;         /* Infinite pill curves */
    
    /* Micro-hairline Borders */
    --border-color: rgba(28, 26, 23, 0.08);
    --border: 1px solid var(--border-color);
    --border-accent: 1px solid rgba(28, 26, 23, 0.15);
    --border-gold: 1px solid rgba(168, 143, 97, 0.25);
    
    /* Soft Atmospheric Shadows */
    --shadow-soft: 0 8px 30px -4px rgba(28, 26, 23, 0.02), 0 2px 8px -2px rgba(28, 26, 23, 0.01);
    --shadow-premium: 0 30px 60px -15px rgba(28, 26, 23, 0.05), 0 0 20px rgba(168, 143, 97, 0.03);
    --shadow-hover: 0 40px 80px -20px rgba(168, 143, 97, 0.1), 0 0 30px rgba(168, 143, 97, 0.05);
    
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* Elegant elastic ease-out */
}

/* ==========================================================================
   GLOBAL DESIGN DEFAULTS
   ========================================================================== */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif; 
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.02em; /* Broad luxurious letter tracking */
}

html, body {
    height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden; 
    background-color: var(--bg-color);
}

body { 
    color: var(--text-main); 
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

/* Fine-Scale Scrollbar styling */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(28, 26, 23, 0.1);
    border-radius: var(--radius-round);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

/* ==========================================================================
   1. EDITORIAL HEADER & BRANDING
   ========================================================================== */
.shop-header {
    flex-shrink: 0;
    z-index: 100;
    background: rgba(250, 249, 245, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 24px 32px; 
    border-bottom: var(--border);
    display: flex; 
    flex-wrap: wrap; 
    gap: 20px; 
    align-items: center; 
    justify-content: space-between;
}

.shop-header h2 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.5rem;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.shop-header h2 i {
    font-size: 1.35rem;
    color: var(--gold);
    transition: var(--transition);
}

/* Minimalist Search Input Line */
.search-box {
    flex-grow: 1; 
    width: 100%;
    order: 3; 
    padding: 12px 18px; 
    font-size: 0.95rem;
    font-weight: 400;
    background: rgba(28, 26, 23, 0.03); 
    border: 1px solid rgba(28, 26, 23, 0.08);
    border-radius: var(--radius-sm); 
    outline: none; 
    transition: var(--transition);
    color: var(--text-main);
}

.search-box::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.search-box:focus { 
    background: var(--card-bg); 
    border-color: var(--gold); 
    box-shadow: 0 0 0 3px var(--gold-glow);
}

@media (min-width: 768px) {
    .shop-header { padding: 24px 48px; flex-wrap: nowrap; gap: 48px; }
    .search-box { width: auto; max-width: 450px; order: unset; }
}

/* ==========================================================================
   2. ATELIER ACTION BUTTONS
   ========================================================================== */
button, .btn-link {
    background: var(--accent); 
    color: var(--text-on-accent); 
    border: 1px solid var(--accent);
    padding: 12px 28px; 
    border-radius: var(--radius-sm); 
    font-weight: 600; 
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer; 
    transition: var(--transition); 
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

button:active, .btn-link:active { 
    transform: scale(0.98); 
}

@media (min-width: 768px) { 
    button:hover, .btn-link:hover { 
        background: transparent;
        color: var(--accent);
        box-shadow: none;
    } 
}

/* Secondary Button - Airy Alabaster */
button.secondary, .btn-link.secondary { 
    background: transparent; 
    color: var(--text-main); 
    border: 1px solid rgba(28, 26, 23, 0.15);
    box-shadow: none;
}
@media (min-width: 768px) { 
    button.secondary:hover, .btn-link.secondary:hover { 
        background: var(--accent); 
        color: var(--text-on-accent);
        border-color: var(--accent);
    } 
}

/* Small Buttons for compact action grids */
button.small, .btn-link.small { 
    padding: 8px 16px; 
    font-size: 0.7rem; 
    letter-spacing: 0.08em;
}

/* Premium Gold Buttons */
button.gold-theme, .btn-link.gold-theme {
    background: var(--gold);
    border-color: var(--gold);
    color: white;
}
@media (min-width: 768px) {
    button.gold-theme:hover, .btn-link.gold-theme:hover {
        background: transparent;
        color: var(--gold);
    }
}

/* Elegant Wine Crimson Danger Action */
button.danger, .btn-link.danger { 
    background: transparent; 
    color: var(--danger); 
    border: 1px solid rgba(155, 45, 45, 0.2);
    box-shadow: none;
}
@media (min-width: 768px) { 
    button.danger:hover, .btn-link.danger:hover { 
        background: var(--danger); 
        color: white; 
        border-color: var(--danger);
    } 
}

nav { display: flex; gap: 10px; flex-wrap: wrap; }

/* ==========================================================================
   3. SPACIOUS WORKSPACE CANVAS (NO CHUNKY BOXES)
   ========================================================================== */
.bento-container { 
    max-width: 1400px; 
    width: 100%;
    margin: 0 auto; 
    padding: 32px 24px 100px 24px; 
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Refined floating cards that present options in high-contrast structure */
.bento-card {
    background: var(--card-bg); 
    border-radius: var(--radius); 
    padding: 32px;
    box-shadow: var(--shadow-soft); 
    margin-bottom: 32px; 
    border: var(--border);
    transition: var(--transition);
}

.header-actions { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 16px;
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 32px; 
    padding-bottom: 16px;
    border-bottom: 1.5px solid var(--text-main);
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.header-actions h2, .header-actions h3 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.4rem;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-main);
}

/* Elegant Platinum Lines Breadcrumbs */
.breadcrumbs {
    padding: 12px 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    margin-bottom: 32px;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gold);
    border: none;
    border-bottom: var(--border);
    box-shadow: none;
    white-space: nowrap;
    overflow-x: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.breadcrumbs span { 
    cursor: pointer; 
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.breadcrumbs span:hover {
    color: var(--text-main);
}
.breadcrumbs span.active { 
    color: var(--text-main); 
    cursor: default; 
    font-weight: 700;
}

/* ==========================================================================
   4. CHIC MINIATURE SHOWCASE GRID
   ========================================================================== */
.grid-view { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 20px; 
}

@media (min-width: 640px) { .grid-view { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 32px; } }
@media (min-width: 1024px) { .grid-view { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); } }

/* Luxury Minimal Category Tile */
.cat-card {
    background: var(--card-bg); 
    border-radius: var(--radius); 
    padding: 32px 16px; 
    cursor: pointer; 
    text-align: center;
    box-shadow: var(--shadow-soft); 
    transition: var(--transition); 
    border: var(--border);
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    aspect-ratio: 1 / 1.05;
    position: relative;
    overflow: hidden;
}

.cat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, rgba(168, 143, 97, 0.04) 0%, transparent 70%);
    opacity: 0;
    transition: var(--transition);
}

.cat-card:active { transform: scale(0.98); }

@media (min-width: 768px) { 
    .cat-card:hover { 
        transform: translateY(-4px); 
        box-shadow: var(--shadow-hover); 
        border-color: var(--gold);
    } 
    .cat-card:hover::before {
        opacity: 1;
    }
}

.cat-img { 
    width: 60px; 
    height: 60px; 
    object-fit: contain; 
    margin-bottom: 20px; 
    transition: var(--transition);
}
.cat-card:hover .cat-img {
    transform: scale(1.08);
}

.cat-title { 
    font-weight: 500; 
    font-size: 0.85rem; 
    color: var(--text-main); 
    text-transform: uppercase;
    letter-spacing: 0.1em;
    line-height: 1.4;
}

/* Fine-Framed Floating Product Exhibition Card */
.product-card {
    background: var(--card-bg); 
    border-radius: var(--radius); 
    padding: 20px; 
    cursor: pointer; 
    box-shadow: var(--shadow-soft); 
    transition: var(--transition); 
    border: var(--border);
    display: flex; 
    flex-direction: column; 
    align-items: flex-start; 
    text-align: left;
    position: relative;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(180deg, rgba(168, 143, 97, 0.02) 0%, transparent 100%);
    opacity: 0;
    transition: var(--transition);
    border-radius: var(--radius);
}

.product-card:active { transform: scale(0.98); }

@media (min-width: 768px) { 
    .product-card:hover { 
        transform: translateY(-4px); 
        box-shadow: var(--shadow-hover); 
        border-color: var(--gold);
    } 
    .product-card:hover::before {
        opacity: 1;
    }
}

.product-img { 
    width: 100%; 
    height: 150px; 
    object-fit: contain; 
    margin-bottom: 20px; 
    border-radius: var(--radius-sm); 
    background: #FAF9F6; 
    padding: 16px;
    transition: var(--transition);
}
.product-card:hover .product-img {
    transform: scale(1.03);
}

.product-path-text { 
    font-size: 0.7rem; 
    color: var(--gold); 
    text-transform: uppercase; 
    font-weight: 600; 
    letter-spacing: 0.12em;
    width: 100%; 
    margin-bottom: 10px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.product-model { 
    font-weight: 400; 
    font-size: 0.95rem; 
    color: var(--text-main);
    margin-bottom: 12px; 
    width: 100%; 
    line-height: 1.5; 
    min-height: 3em; 
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price { 
    font-weight: 600; 
    font-size: 1.15rem; 
    color: var(--text-main); 
    width: 100%; 
    margin-top: auto; 
    display: flex;
    align-items: center;
    justify-content: space-between;
    letter-spacing: 0.05em;
}

/* Chic Corner Sold Badge */
.sold-out-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: var(--danger);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    z-index: 2;
    text-transform: uppercase;
}

/* ==========================================================================
   5. ATELIER IMMERSIVE CLINICAL OVERLAY MODALS
   ========================================================================== */
.product-modal-overlay, .modal-overlay {
    position: fixed; 
    top: 0; left: 0; 
    width: 100vw; height: 100dvh;
    background: rgba(28, 26, 23, 0.4); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    display: flex; 
    justify-content: center; 
    align-items: flex-end; 
    opacity: 0; pointer-events: none; 
    transition: var(--transition); 
    z-index: 1000;
}
.product-modal-overlay.active, .modal-overlay.active { opacity: 1; pointer-events: auto; }

.product-modal, .modal-content {
    background: var(--card-bg); 
    width: 100%; 
    max-height: 90dvh;
    border-radius: var(--radius) var(--radius) 0 0; 
    box-shadow: 0 -20px 60px rgba(28, 26, 23, 0.05);
    display: flex; 
    flex-direction: column; 
    overflow-y: auto;
    transform: translateY(100%); 
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    border: var(--border);
}
.modal-content { padding: 40px 24px; border: none; }
.product-modal-overlay.active .product-modal, .modal-overlay.active .modal-content { transform: translateY(0); }

/* Editorial Details Grid within Modal */
.modal-img-col { 
    background: #FAF9F6; 
    padding: 48px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-bottom: var(--border);
    position: relative;
}
.modal-img-col img { 
    max-width: 100%; 
    max-height: 240px; 
    object-fit: contain; 
}

.modal-info-col { 
    padding: 32px 24px; 
    display: flex; 
    flex-direction: column; 
}
.modal-path { 
    font-size: 0.75rem; 
    color: var(--gold); 
    margin-bottom: 12px; 
    font-weight: 600; 
    text-transform: uppercase; 
    letter-spacing: 0.12em;
}
.modal-title { 
    font-size: 1.6rem; 
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 300; 
    color: var(--text-main);
    margin-bottom: 20px; 
    line-height: 1.3; 
    letter-spacing: 0.05em;
}
.modal-price { 
    font-size: 1.8rem; 
    font-weight: 500; 
    color: var(--text-main); 
    margin-bottom: 32px; 
    letter-spacing: 0.04em;
}

.modal-actions { 
    display: flex; 
    gap: 16px; 
    margin-top: 32px; 
    flex-direction: column-reverse; 
}
.modal-actions button { width: 100%; }

/* Desktop Sophisticated Wide Modal Overrides */
@media (min-width: 768px) {
    .product-modal-overlay, .modal-overlay { align-items: center; }
    .product-modal, .modal-content {
        flex-direction: row; 
        width: 85%; 
        max-width: 900px;
        height: auto;
        border-radius: var(--radius); 
        transform: translateY(40px) scale(0.97);
        overflow: hidden;
    }
    .modal-content { flex-direction: column; max-width: 520px; max-height: 90dvh; overflow-y: auto; }
    .product-modal-overlay.active .product-modal, .modal-overlay.active .modal-content { transform: translateY(0) scale(1); }
    
    .modal-img-col { 
        flex: 1.1; 
        border-bottom: none;
        border-right: var(--border);
    }
    .modal-info-col { 
        flex: 1; 
        padding: 48px; 
        justify-content: center; 
    }
    .modal-actions { flex-direction: row; justify-content: flex-end; }
    .modal-actions button { width: auto; }
}

/* ==========================================================================
   6. CLEAN ARCHITECTURAL FORMS
   ========================================================================== */
.form-group { margin-bottom: 28px; }
.form-group label { 
    display: block; 
    margin-bottom: 10px; 
    font-weight: 600; 
    color: var(--text-main); 
    font-size: 0.8rem; 
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.form-group input, .form-group select, .modal-input {
    width: 100%; 
    padding: 14px 18px; 
    border: 1px solid rgba(28, 26, 23, 0.15); 
    border-radius: var(--radius-sm);
    font-size: 0.95rem; 
    background: rgba(28, 26, 23, 0.01); 
    transition: var(--transition); 
    appearance: none; 
    color: var(--text-main);
    outline: none;
}
.form-group input:focus, .form-group select:focus, .modal-input:focus { 
    border-color: var(--gold); 
    background: var(--card-bg);
    box-shadow: 0 0 0 3px var(--gold-glow);
}
.form-group input[type="file"] { 
    padding: 12px; 
    font-size: 0.8rem; 
    background: transparent; 
    border: 1px dashed rgba(28, 26, 23, 0.2); 
}

/* ==========================================================================
   7. CHIC ATELIER TABLES
   ========================================================================== */
.data-table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 16px; 
}
.data-table th { 
    padding: 16px 20px; 
    font-weight: 600; 
    color: var(--text-muted); 
    text-transform: uppercase; 
    font-size: 0.7rem; 
    letter-spacing: 0.12em;
    border-bottom: 1.5px solid var(--text-main);
    text-align: left;
}
.data-table td { 
    padding: 20px; 
    border-bottom: var(--border);
    vertical-align: middle; 
    background: transparent;
}

.data-table img { 
    width: 52px; 
    height: 40px; 
    object-fit: contain; 
    border-radius: var(--radius-sm); 
    background: #FAF9F6; 
    border: var(--border); 
}

/* Action cell layout */
.action-cell {
    display: flex;
    gap: 8px;
}

/* Responsive Table Card Transformation */
@media (max-width: 768px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr { display: block; width: 100%; }
    .data-table tr { 
        display: flex; 
        flex-wrap: wrap; 
        align-items: center; 
        gap: 12px; 
        background: var(--card-bg); 
        border: var(--border); 
        border-radius: var(--radius-sm); 
        margin-bottom: 20px; 
        padding: 20px; 
        box-shadow: var(--shadow-soft);
    }
    .data-table td { padding: 0; border: none; display: block; }
    .data-table td:nth-child(1) { width: 60px; } 
    .data-table td:nth-child(2) { flex: 1; min-width: calc(100% - 80px); } 
    .data-table td:nth-child(3) { width: 100%; font-size: 1.1rem; font-weight: 600; color: var(--text-main); margin-top: 8px; } 
    .data-table td:nth-child(4) { width: 100%; display: flex; gap: 8px; margin-top: 16px; border-top: var(--border); padding-top: 16px; } 
    .data-table td:nth-child(4) button { flex: 1; } 
}

/* ==========================================================================
   8. SYSTEM & SETUP TREES
   ========================================================================== */
.tree-container { 
    background: transparent; 
    border-radius: 0; 
    padding: 0; 
    border: none; 
}
.tree-container ul { list-style: none; }
.tree-children { padding-left: 24px !important; border-left: 1px solid rgba(28, 26, 23, 0.08); margin-top: 12px; }

.node-content {
    display: flex; 
    flex-direction: column; 
    gap: 16px;
    background: var(--card-bg); 
    padding: 20px; 
    border-radius: var(--radius-sm); 
    margin-bottom: 16px;
    border: var(--border); 
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
}
.node-content:hover {
    border-color: var(--gold);
}

.node-info { display: flex; align-items: center; gap: 16px; flex: 1; }
.node-img { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: contain; background: #FAF9F6; border: var(--border); }
.node-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.toggle-btn { 
    background: transparent; 
    color: var(--text-muted); 
    padding: 0; 
    border-radius: 0; 
    font-size: 0.65rem; 
    width: 28px; height: 28px; 
    border: var(--border);
    display: flex; align-items: center; justify-content: center; 
    transition: var(--transition);
}
.toggle-btn.open { transform: rotate(90deg); background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }

@media (min-width: 768px) {
    .tree-children { padding-left: 40px !important; }
    .node-content { flex-direction: row; justify-content: space-between; align-items: center; }
}

/* Template Setup Items */
.template-item-row { 
    display: flex; 
    flex-wrap: wrap;
    justify-content: space-between; 
    align-items: center; 
    gap: 12px;
    padding: 16px; 
    background: var(--card-bg); 
    border: var(--border); 
    border-radius: var(--radius-sm); 
    margin-bottom: 12px; 
}
.template-item-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.template-item-left input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

/* Custom Checkbox Grid */
.checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 8px;
}

/* ==========================================================================
   9. EDITORIAL TOAST NOTIFICATIONS
   ========================================================================== */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--text-on-accent);
    padding: 14px 32px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    box-shadow: 0 10px 40px rgba(28,26,23,0.1);
    z-index: 9999;
    transition: bottom 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border-color);
}
.toast.show { bottom: 40px; }