/* ==========================================================================
   PLATEFORME WEB DE GESTION DE STOCK & SCAN IA - DESIGN SYSTEM & THEME
   ========================================================================== */

:root {
    /* Main Color Palette (Modern Dark Slate Glassmorphism) */
    --bg-main: #0b0f19;
    --bg-card: rgba(21, 30, 49, 0.7);
    --bg-card-border: rgba(255, 255, 255, 0.1);
    --bg-input: rgba(15, 23, 42, 0.8);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.2);
    --accent-emerald: #10b981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.2);
    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.2);
    --accent-rose: #f43f5e;
    --accent-rose-glow: rgba(244, 63, 94, 0.2);
    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.2);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================================================
   MODE CLAIR (LIGHT MODE VARIABLES & OVERRIDES)
   ========================================================================== */
[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-border: rgba(203, 213, 225, 0.8);
    --bg-input: #ffffff;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-blue-glow: rgba(59, 130, 246, 0.12);
    --accent-emerald-glow: rgba(16, 185, 129, 0.12);
    --accent-amber-glow: rgba(245, 158, 11, 0.12);
    --accent-rose-glow: rgba(244, 63, 94, 0.12);
    --accent-purple-glow: rgba(139, 92, 246, 0.12);
}

[data-theme="light"] body {
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
}

[data-theme="light"] .glass-card {
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sidebar-nav {
    background: rgba(255, 255, 255, 0.95);
    border-right: 1px solid rgba(226, 232, 240, 0.9);
}

[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

[data-theme="light"] .nav-item {
    color: var(--text-secondary);
}

[data-theme="light"] .nav-item:hover, 
[data-theme="light"] .nav-item.active {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .sidebar-btn {
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}
[data-theme="light"] .sidebar-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .sidebar-header {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .sidebar-footer {
    border-top-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .data-table tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .card-img-wrapper {
    background: #e2e8f0;
}

[data-theme="light"] .card-metrics-grid {
    background: rgba(241, 245, 249, 0.8);
}

[data-theme="light"] .urgent-item-row {
    background: rgba(241, 245, 249, 0.8);
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--bg-card-border);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.12) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism Card Utility */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
}

/* App Shell Layout - Sidebar */
.layout-sidebar {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar-nav {
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--bg-card-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

/* Sidebar Toggle Logic */
.sidebar-nav.closed {
    transform: translateX(-100%);
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: 260px; /* Width of sidebar */
    transition: margin-left 0.3s ease;
}

.main-wrapper.expanded {
    margin-left: 0;
}

@media (max-width: 900px) {
    .sidebar-nav {
        transform: translateX(-100%); /* Closed by default on mobile */
    }
    .sidebar-nav.open-mobile {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0; /* Always 0 on mobile */
    }
    .d-mobile-only {
        display: block;
    }
}
@media (min-width: 901px) {
    .d-mobile-only {
        display: none;
    }
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    font-size: 1.75rem;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 800;
    font-size: 1.15rem;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.5rem;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item .icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.nav-item:hover, .nav-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
    background: rgba(96, 165, 250, 0.15);
    border-left: 3px solid var(--accent-blue);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}
.sidebar-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* End duplicate */

.topbar {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--bg-card-border);
    position: sticky;
    top: 0;
    z-index: 90;
    gap: 1rem;
}

.app-container {
    flex: 1;
    max-width: 100%;
    padding: 1.5rem;
}

/* Page Headers */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--bg-card-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
    background: var(--accent-rose);
    color: white;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* Stats Grid & Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.bg-blue-glow { background: var(--accent-blue-glow); }
.bg-emerald-glow { background: var(--accent-emerald-glow); }
.bg-amber-glow { background: var(--accent-amber-glow); }
.bg-rose-glow { background: var(--accent-rose-glow); }

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0.15rem 0;
}

.stat-value .currency, .stat-value .unit {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Dashboard Charts Grid */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .dashboard-charts-grid {
        grid-template-columns: 1fr;
    }
}

.canvas-container {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

.urgent-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.urgent-item-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
}

.item-thumb {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.item-info { flex: 1; }
.item-title { font-size: 0.85rem; font-weight: 600; }
.item-sub { font-size: 0.75rem; color: var(--text-muted); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-danger { background: rgba(244, 63, 94, 0.2); color: #f87171; }
.badge-purple { background: rgba(139, 92, 246, 0.2); color: #c084fc; }
.badge-neutral { background: rgba(255, 255, 255, 0.1); color: var(--text-secondary); }
.badge-ai { background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: #ffffff; }

/* Stock Search & Filter Bar */
.search-filter-section {
    margin-bottom: 1.5rem;
}

.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 0.9rem 1.25rem 0.9rem 3rem;
    background: var(--bg-input);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.clear-btn {
    position: absolute;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

.filters-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-pills {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pill {
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--bg-card-border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
}

.pill.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.form-select, .form-input, .form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

.card-img-wrapper {
    position: relative;
    height: 160px;
    width: 100%;
    background: #1e293b;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-status-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

.card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-category {
    font-size: 0.75rem;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0.35rem 0;
    line-height: 1.3;
}

.card-sku {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.card-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.metric-label { font-size: 0.7rem; color: var(--text-muted); display: block; }
.metric-value { font-size: 1rem; font-weight: 700; }

.card-numeraire-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--bg-card-border);
    margin-bottom: 1rem;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
}

.card-actions .btn { flex: 1; }

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.data-table th {
    padding: 0.4rem 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--bg-card-border);
    white-space: nowrap;
}

.data-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

@media (max-width: 768px) {
    .data-table, .data-table thead, .data-table tbody, .data-table tr, .data-table th, .data-table td {
        display: block;
        width: 100%;
    }
    
    .data-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .data-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--bg-card-border);
        border-radius: var(--radius-sm);
        background: rgba(255, 255, 255, 0.02);
    }
    
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        padding: 0.75rem;
        font-size: 0.85rem;
        white-space: normal;
        word-break: break-word;
    }
    
    .data-table td:last-child {
        border-bottom: none;
    }
    
    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-align: left;
        margin-right: 1rem;
        flex-shrink: 0;
        max-width: 40%;
    }
    
    .d-none-mobile {
        display: none !important;
    }
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* SCANNER IA & LASER ANIMATION */
.upload-area {
    border: 2px dashed var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 3rem 1.5rem;
    text-align: center;
    transition: border-color 0.2s;
}

.upload-area:hover {
    border-color: var(--accent-blue);
}

.upload-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.upload-buttons-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.hidden-input { display: none; }

.demo-samples-section {
    margin-top: 2rem;
    text-align: center;
}

.demo-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.sample-pills {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sample-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.sample-btn:hover {
    background: var(--accent-blue-glow);
    border-color: var(--accent-blue);
}

.laser-scanner-container {
    position: relative;
    max-width: 450px;
    margin: 0 auto 1.5rem auto;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.laser-scanner-container img {
    width: 100%;
    display: block;
}

.laser-scan-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #00f0ff;
    box-shadow: 0 0 15px #00f0ff, 0 0 30px #00f0ff;
    animation: scanLaser 2s infinite ease-in-out alternate;
}

@keyframes scanLaser {
    0% { top: 0%; }
    100% { top: 98%; }
}

.loader-text-status {
    text-align: center;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem auto;
}

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

/* Confirmation Section Grid */
.confirmation-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .confirmation-grid { grid-template-columns: 1fr; }
}

.conf-image-column {
    position: relative;
}

.conf-image {
    width: 100%;
    border-radius: var(--radius-md);
    object-fit: cover;
    max-height: 350px;
}

.source-tag {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    background: rgba(0,0,0,0.75);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
}

.highlight-box {
    background: rgba(16, 185, 129, 0.08);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.label-highlight {
    color: #34d399 !important;
    font-weight: 700 !important;
}

.numeraire-card {
    background: rgba(59, 130, 246, 0.1);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.numeraire-label { font-size: 0.85rem; color: #93c5fd; }
.numeraire-value-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.numeraire-input {
    font-size: 1.75rem;
    font-weight: 800;
    background: none;
    border: none;
    color: #60a5fa;
    width: 100%;
}

.confirmation-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-backdrop.hidden { display: none; }

.modal-window {
    max-width: 550px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.form-group {
    margin-bottom: 1.15rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--bg-card-border);
    color: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    font-size: 0.9rem;
}

.toast-close { background: none; border: none; color: white; cursor: pointer; }

/* Helpers */
.hidden { display: none !important; }
.text-emerald { color: #34d399 !important; }
.text-amber { color: #fbbf24 !important; }
.text-rose { color: #f87171 !important; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* ==========================================================================
   MOBILE & RESPONSIVE IMPROVEMENTS
   ========================================================================== */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }
    
    .topbar {
        padding: 0.75rem 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .search-filter-section .filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-pills {
        justify-content: center;
    }
    
    .pill {
        flex: 1 1 auto;
        text-align: center;
    }

    .modal-window {
        padding: 1.25rem;
        margin: 0.5rem;
        max-height: 95vh;
    }

    .card-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .card-actions .btn {
        width: 100%;
    }
    
    .upload-buttons-row {
        flex-direction: column;
    }

    .upload-buttons-row .btn {
        width: 100%;
    }
    
    /* Bigger touch targets */
    .btn, .nav-item, .pill, .form-input, .form-select, .form-textarea, .sidebar-btn {
        min-height: 44px; /* Minimum mobile touch target */
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
    }
    .stat-value {
        font-size: 1.25rem;
    }
    .brand-title {
        font-size: 1rem;
    }
}

/* ==========================================================================
   STYLES DE GÉNÉRATION PDF & IMPRESSION OFFICIELLE
   ========================================================================== */
@media print {
    @page { 
        margin: 0; 
        size: A4 portrait;
    } 
    body, html { 
        margin: 0 !important; 
        padding: 0 !important; 
        background: white !important; 
        width: 100% !important;
        height: 100% !important;
        overflow: visible !important;
    }
    
    /* Cache toute l'interface de l'application pour accélérer drastiquement la préparation de l'impression */
    #app-root {
        display: none !important;
    }
    
    /* Afficher uniquement la zone d'impression (qui est ajoutée à la fin du body) */
    #print-modal-overlay {
        position: static !important; /* CRITICAL: Flex or Fixed position kills Chrome print pagination */
        display: block !important;
        width: 100% !important;
        height: auto !important;
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        visibility: visible !important;
        overflow: visible !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    #print-modal-overlay * {
        visibility: visible !important;
    }
    .no-print {
        display: none !important;
    }
    .modal-window {
        position: static !important;
        display: block !important; /* CRITICAL: no flex */
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0.5cm !important; /* Padding ajusté */
        margin: 0 !important;
        background: white !important;
        color: #0f172a !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}
