/* ========================================
   BENJA STOCK - PREMIUM DESIGN SYSTEM
   Luxury Executive Style (Midnight & Gold)
   Compatible with Light/Dark Mode
   ======================================== */

:root {
    /* --- LUXURY PALETTE (Refined & Softer) --- */
    --luxury-midnight: #1A1A1E;
    /* Deeper but softer */
    --luxury-gold: #C5A059;
    /* Champagne Gold (more muted) */
    --luxury-gold-soft: #DACEB8;
    --luxury-gold-glow: rgba(197, 160, 89, 0.1);
    /* Reduced opacity */

    /* --- STATUS COLORS (Balanced) --- */
    --premium-success: #10B981;
    --premium-danger: #EF4444;
    --premium-warning: #F59E0B;
    --premium-info: #3B82F6;

    /* --- BACKGROUNDS & SURFACES (Better contrast) --- */
    --stock-bg: #F5F5F7;
    /* Apple Neutral Gray */
    --stock-card-bg: #FFFFFF;
    --stock-text: #1D1D21;
    --stock-text-secondary: #86868B;
    /* Softer text */
    --stock-border: #E5E7EB;

    /* --- TYPOGRAPHY --- */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
    --stock-bg: #0D0D0F;
    --stock-card-bg: #1C1C1E;
    /* Standard iOS Dark surface */
    --stock-text: #F5F5F7;
    --stock-text-secondary: #86868B;
    --stock-border: #2C2C2E;

    --luxury-midnight: #F5F5F7;
    --luxury-gold-glow: rgba(197, 160, 89, 0.15);
}

/* ========================================
   GLOBAL TYPOGRAPHY
   ======================================== */
body {
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
}

/* Force Tabular Numbers for all digits */
span,
div,
td,
th,
input {
    font-variant-numeric: tabular-nums;
}

/* ========================================
   PREMIUM BUTTONS
   ======================================== */
.btn-add-premium {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.75rem;
    background: var(--luxury-midnight);
    color: var(--stock-card-bg) !important;
    border: 1px solid var(--luxury-midnight);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-add-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    background: #2D2D33;
    border-color: var(--luxury-gold);
}

.btn-add-premium:active {
    transform: translateY(0) scale(0.98);
}

.btn-add-premium svg {
    stroke: var(--luxury-gold);
    stroke-width: 2.5px;
}

/* Secondary Gold Button */
.btn-gold-outline {
    background: transparent;
    color: var(--luxury-gold);
    border: 1.5px solid var(--luxury-gold);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-gold-outline:hover {
    background: var(--luxury-gold-glow);
}

/* ========================================
   KPI CARDS overhaul
   ======================================== */
.kpi-card {
    background: var(--stock-card-bg);
    border: 1px solid var(--stock-border);
    border-radius: 20px;
    padding: 1.75rem;
    display: flex;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    border-color: var(--luxury-gold);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.kpi-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--stock-text-secondary);
    margin-bottom: 0.5rem;
}

.kpi-value {
    display: block;
    font-size: 1.875rem;
    font-weight: 600;
    /* Sophisticated weight */
    color: var(--stock-text);
    letter-spacing: -0.03em;
}

.kpi-unit {
    font-size: 1rem;
    font-weight: 500;
    color: var(--stock-text-secondary);
    margin-left: 2px;
}

.kpi-subtext {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* --- PROGRESS BARS (Dashboard) --- */
.progress-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.progress-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--stock-text);
    width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-track {
    flex: 1;
    height: 8px;
    background: var(--stock-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--luxury-gold);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--stock-text);
    width: 40px;
    text-align: right;
}

/* ========================================
   CHART CARDS (Dashboard & Analytics)
   ======================================== */
.chart-card {
    background: var(--stock-card-bg);
    border: 1px solid var(--stock-border);
    border-radius: 18px;
    padding: 1.5rem;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.chart-card:hover {
    border-color: var(--luxury-gold);
}

.premium-shadow {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--stock-text);
    margin: 0;
}

.chart-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--stock-text-secondary);
    margin: 0;
}

.chart-body {
    flex: 1;
    position: relative;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-body canvas {
    max-width: 100%;
    height: auto;
}

.chart-center-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.stock-table-container {
    width: 100%;
    overflow-x: auto;
}

.scrollable-table {
    max-height: 400px;
    overflow-y: auto;
}

/* ========================================
   LOCATION DISTRIBUTION BAR
   ======================================== */
.location-bar-container {
    display: flex;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: var(--stock-bg);
    border: 1px solid var(--stock-border);
}

.location-segment {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--stock-card-bg);
    position: relative;
    padding: 1.5rem 1rem;
}

.location-segment:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: var(--stock-border);
}

.location-segment:hover {
    background: rgba(197, 160, 89, 0.03);
    transform: translateY(-2px);
}

.location-segment.depot {
    border-left: 3px solid #E5E7EB;
}

.location-segment.boutique {
    border-left: 3px solid #C5A059;
}

.location-segment.atelier {
    border-left: 3px solid #86868B;
}

[data-theme="dark"] .location-segment.depot {
    border-left-color: #3B82F6;
}

[data-theme="dark"] .location-segment.boutique {
    border-left-color: #C5A059;
}

[data-theme="dark"] .location-segment.atelier {
    border-left-color: #8B5CF6;
}

.loc-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--stock-text-secondary);
}

.loc-val {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--stock-text);
    font-variant-numeric: tabular-nums;
}

/* ========================================
   TABLE REFINEMENTS
   ======================================== */
.stock-table {
    width: 100%;
    border-collapse: collapse;
}

.stock-table th {
    padding: 0.875rem 1rem;
    font-size: 0.75rem;
    color: var(--stock-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid var(--stock-border);
}

.stock-table td {
    background: var(--stock-card-bg);
    padding: 1rem 1rem;
    border-bottom: 1px solid var(--stock-border);
    transition: background 0.2s ease;
}

.stock-table tbody tr:hover td {
    background: rgba(197, 160, 89, 0.03);
}

.stock-table td:first-child {
    border-left: 1px solid var(--stock-border);
    border-radius: 12px 0 0 12px;
}

.stock-table td:last-child {
    border-right: 1px solid var(--stock-border);
    border-radius: 0 12px 12px 0;
}

.stock-table tr:hover td {
    border-color: var(--luxury-gold-soft);
    background: var(--luxury-gold-glow);
}

/* ========================================
   MODALS & FORMS
   ======================================== */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(10, 10, 15, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    z-index: 10050;
}

.modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--stock-card-bg);
    border-radius: 20px;
    border: 1px solid var(--stock-border);
    padding: 0;
    overflow: hidden;
    width: min(720px, calc(100% - 2.5rem));
    max-height: 90vh;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
    transform: translateY(8px) scale(0.98);
    transition: transform 180ms ease, opacity 180ms ease;
    opacity: 0.98;
}

.modal.is-open .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-header {
    padding: 1.5rem 2rem 1.25rem;
    border-bottom: 1px solid var(--stock-border);
    background: linear-gradient(to bottom, var(--stock-bg), transparent);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.modal-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: var(--stock-text-secondary);
    margin: 0;
}

.modal-body {
    padding: 1.5rem 2rem 0.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 2rem 1.75rem;
    border-top: 1px solid var(--stock-border);
    background: var(--stock-card-bg);
}

.close-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--stock-text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.close-btn:hover {
    background: var(--luxury-gold-glow);
    color: var(--luxury-gold);
    transform: translateY(-1px);
}

body.modal-open {
    overflow: hidden;
}

.form-control {
    background: var(--stock-bg);
    border: 1.5px solid var(--stock-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--stock-text);
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--luxury-gold);
    box-shadow: 0 0 0 4px var(--luxury-gold-glow);
    outline: none;
}

/* ========================================
   FILTER DRAWER SYSTEM (Premium Side Panel)
   ======================================== */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.filter-drawer {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 420px;
    max-width: 90vw;
    background: var(--stock-card-bg);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filter-drawer.open {
    transform: translateX(0);
}

.filter-drawer-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--stock-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--stock-bg);
}

.filter-drawer-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--stock-text);
    margin: 0;
}

.filter-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.filter-section {
    margin-bottom: 2rem;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--stock-text-secondary);
    margin-bottom: 1rem;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-option:hover {
    padding-left: 0.5rem;
}

.filter-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--stock-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-option input[type="checkbox"]:checked {
    background: var(--luxury-gold);
    border-color: var(--luxury-gold);
}

.filter-option span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--stock-text);
}

.filter-drawer-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--stock-border);
    display: flex;
    gap: 1rem;
    background: var(--stock-bg);
}

.filter-drawer-footer button {
    flex: 1;
}

/* RTL Support for Drawer */

/* RTL Support for Drawer */
[dir="rtl"] .filter-drawer {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.15);
}

[dir="rtl"] .filter-drawer.open {
    transform: translateX(0);
}

/* ========================================
   MINIMALIST "+" BUTTON (Apple Style)
   ======================================== */
.btn-add-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--luxury-midnight);
    border: 1px solid var(--luxury-midnight);
    color: var(--stock-card-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
}

.btn-add-icon:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    background: #2D2D33;
    border-color: var(--luxury-gold);
}

.btn-add-icon:active {
    transform: translateY(0) scale(0.98);
}

.btn-add-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--luxury-gold);
    stroke-width: 2.5px;
}

/* Tooltip for "+" button */
.btn-add-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: var(--luxury-midnight);
    color: var(--luxury-gold-light);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-add-icon:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ========================================
   CLEAR FILTERS BUTTON ("✕")
   ======================================== */
.btn-clear-filters {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
    border: 1.5px solid var(--stock-border);
    color: var(--stock-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-clear-filters:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--premium-danger);
    color: var(--premium-danger);
    transform: rotate(90deg);
}

.btn-clear-filters:active {
    transform: rotate(90deg) scale(0.95);
}

/* ========================================
   LOCATION QUANTITY BOXES (Premium Redesign)
   ======================================== */
.stock-badge-box {
    background: linear-gradient(135deg, var(--stock-bg) 0%, var(--stock-card-bg) 100%);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--stock-border);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stock-badge-box:hover {
    border-color: var(--luxury-gold);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.stock-badge-box .label {
    font-size: 0.7rem;
    color: var(--stock-text-secondary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stock-badge-box .value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--stock-text);
    letter-spacing: -0.02em;
}

/* Dark mode enhancement */
[data-theme="dark"] .stock-badge-box {
    background: linear-gradient(135deg, #1C1C1E 0%, #27272A 100%);
    border-color: #2C2C2E;
}

[data-theme="dark"] .stock-badge-box:hover {
    border-color: var(--luxury-gold);
    background: linear-gradient(135deg, #27272A 0%, #2C2C2E 100%);
}

/* ========================================
   NUMBER COUNTER ANIMATIONS
   ======================================== */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-count {
    animation: countUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Stagger animation delays for multiple counters */
.animate-count:nth-child(1) {
    animation-delay: 0ms;
}

.animate-count:nth-child(2) {
    animation-delay: 100ms;
}

.animate-count:nth-child(3) {
    animation-delay: 200ms;
}

.animate-count:nth-child(4) {
    animation-delay: 300ms;
}

/* ========================================
   CHART ANIMATIONS
   ======================================== */
@keyframes chartFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes chartSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chart-card {
    animation: chartFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.chart-card:nth-child(1) {
    animation-delay: 0ms;
}

.chart-card:nth-child(2) {
    animation-delay: 150ms;
}

.chart-card:nth-child(3) {
    animation-delay: 300ms;
}

/* ========================================
   ACTIVE FILTER CHIPS (Enhanced)
   ======================================== */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    min-height: 32px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--luxury-gold-glow);
    border: 1px solid var(--luxury-gold);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--stock-text);
    animation: chipSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chipSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.filter-chip .remove-filter {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.2s ease;
}

.filter-chip .remove-filter:hover {
    background: var(--luxury-gold);
    transform: rotate(90deg);
}

.filter-chip .remove-filter svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
}

/* ========================================
   BADGE ENHANCEMENTS (Status)
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--premium-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--premium-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--premium-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ========================================
   PREMIUM GLASSMORPHISM UTILITIES
   ======================================== */
.glass-effect {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .glass-effect {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ========================================
   PREMIUM PRODUCT CARDS (Apple-Style)
   ======================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.product-card {
    background: var(--stock-card-bg);
    border: 1px solid var(--stock-border);
    border-radius: 18px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 280px;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    border-color: var(--luxury-gold);
}

/* Card Header - Image & Reference */
.product-card-header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.product-card-image {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--stock-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--stock-border);
}

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

.product-card-image svg {
    width: 32px;
    height: 32px;
    color: var(--stock-text-secondary);
}

.product-card-info {
    flex: 1;
    min-width: 0;
}

.product-card-ref {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--luxury-gold-glow);
    border: 1px solid var(--luxury-gold);
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--luxury-gold);
    margin-bottom: 0.5rem;
}

.product-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--stock-text);
    margin-bottom: 0.25rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card-category {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: rgba(13, 148, 136, 0.1);
    border: 1px solid rgba(13, 148, 136, 0.2);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--teal-600);
}

/* Card Body - Stock & Location */
.product-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0;
    border-top: 1px solid var(--stock-border);
    border-bottom: 1px solid var(--stock-border);
}

.product-stock-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-stock-total {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--stock-text);
    letter-spacing: -0.02em;
}

.product-stock-unit {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--stock-text-secondary);
    margin-left: 0.25rem;
}

.product-locations {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.location-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: var(--stock-bg);
    border: 1px solid var(--stock-border);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--stock-text);
}

.location-badge-icon {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--stock-text-secondary);
}

.location-badge.depot .location-badge-icon {
    background: #3B82F6;
}

.location-badge.boutique .location-badge-icon {
    background: var(--luxury-gold);
}

.location-badge.atelier .location-badge-icon {
    background: #8B5CF6;
}

/* Card Footer - Price & Actions */
.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
}

.product-price-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.product-price-main {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--stock-text);
    letter-spacing: -0.01em;
}

.product-price-wholesale {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--stock-text-secondary);
}

.product-actions {
    display: flex;
    gap: 0.5rem;
}

.product-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid var(--stock-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--stock-text-secondary);
}

.product-action-btn:hover {
    background: var(--luxury-gold-glow);
    border-color: var(--luxury-gold);
    color: var(--luxury-gold);
    transform: translateY(-2px);
}

.product-action-btn:active {
    transform: translateY(0) scale(0.95);
}

.product-action-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.product-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--premium-danger);
    color: var(--premium-danger);
}

/* Card Animations */
@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: cardFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.product-card:nth-child(1) {
    animation-delay: 0ms;
}

.product-card:nth-child(2) {
    animation-delay: 50ms;
}

.product-card:nth-child(3) {
    animation-delay: 100ms;
}

.product-card:nth-child(4) {
    animation-delay: 150ms;
}

.product-card:nth-child(5) {
    animation-delay: 200ms;
}

.product-card:nth-child(6) {
    animation-delay: 250ms;
}

/* Empty State */
.products-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--stock-text-secondary);
}

.products-empty svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    opacity: 0.5;
}

.products-empty h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--stock-text);
    margin-bottom: 0.5rem;
}

.products-empty p {
    font-size: 0.95rem;
    color: var(--stock-text-secondary);
}

/* ========================================
   VIEW TOGGLE (Segmented Control - Apple Style)
   ======================================== */

.view-toggle-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.view-toggle {
    display: inline-flex;
    background: var(--stock-bg);
    border: 1px solid var(--stock-border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--stock-text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.view-toggle-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.view-toggle-btn.active {
    background: var(--stock-card-bg);
    color: var(--stock-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.view-toggle-btn:hover:not(.active) {
    color: var(--stock-text);
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .view-toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

/* View Container Transitions */
#productsViewContainer {
    position: relative;
    min-height: 400px;
}

.view-cards,
.view-table {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
}

.view-cards.active,
.view-table.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    position: relative;
}

/* ========================================
   PREMIUM TABLE VIEW (Apple/Stripe Level)
   ======================================== */

.products-table-view {
    width: 100%;
    overflow-x: auto;
}

.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
}

/* Header - Sticky & Élégant */
.premium-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--stock-bg);
}

.premium-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--stock-text-secondary);
    border-bottom: 1px solid var(--stock-border);
    background: var(--stock-bg);
    white-space: nowrap;
}

.premium-table th:first-child {
    padding-left: 2rem;
}

.premium-table th:last-child {
    padding-right: 2rem;
    text-align: right;
}

/* Rows - Minimaliste & Aéré */
.premium-table tbody tr {
    background: var(--stock-card-bg);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .premium-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.premium-table tbody tr:hover {
    background: var(--luxury-gold-glow);
    transform: scale(1.001);
}

.premium-table td {
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    color: var(--stock-text);
    vertical-align: middle;
}

.premium-table td:first-child {
    padding-left: 2rem;
}

.premium-table td:last-child {
    padding-right: 2rem;
}

/* Product Cell - Première colonne */
.premium-table .table-product-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 280px;
}

.premium-table .table-product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--stock-bg);
    border: 1px solid var(--stock-border);
    flex-shrink: 0;
}

.premium-table .table-product-thumb svg {
    width: 24px;
    height: 24px;
    color: var(--stock-text-secondary);
}

.premium-table .table-product-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.premium-table .table-product-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--stock-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.premium-table .table-product-category {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: rgba(13, 148, 136, 0.1);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--teal-600);
    width: fit-content;
}

/* Reference Cell */
.premium-table .table-ref-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--luxury-gold-glow);
    border: 1px solid var(--luxury-gold);
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--luxury-gold);
}

/* Quantity Cell */
.premium-table .table-qty-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 1rem;
    color: var(--stock-text);
}

.premium-table .table-qty-unit {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--stock-text-secondary);
    margin-left: 0.25rem;
}

/* Location Cell */
.premium-table .table-locations {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.premium-table .table-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    background: var(--stock-bg);
    border: 1px solid var(--stock-border);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--stock-text);
    white-space: nowrap;
}

.premium-table .table-location-icon {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--stock-text-secondary);
}

.premium-table .table-location-badge.depot .table-location-icon {
    background: #3B82F6;
}

.premium-table .table-location-badge.boutique .table-location-icon {
    background: var(--luxury-gold);
}

.premium-table .table-location-badge.atelier .table-location-icon {
    background: #8B5CF6;
}

/* Status Cell */
.premium-table .table-status-cell {
    text-align: center;
}

/* Price Cell */
.premium-table .table-price-cell {
    font-variant-numeric: tabular-nums;
}

.premium-table .table-price-main {
    font-weight: 700;
    font-size: 1rem;
    color: var(--stock-text);
}

.premium-table .table-price-wholesale {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--stock-text-secondary);
    margin-top: 0.15rem;
}

/* Actions Cell */
.premium-table .table-actions-cell {
    text-align: right;
}

.premium-table .table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.premium-table .table-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--stock-text-secondary);
}

.premium-table .table-action-btn:hover {
    background: var(--luxury-gold-glow);
    border-color: var(--luxury-gold);
    color: var(--luxury-gold);
    transform: translateY(-1px);
}

.premium-table .table-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--premium-danger);
    color: var(--premium-danger);
}

.premium-table .table-action-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* Empty State */
.premium-table .table-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--stock-text-secondary);
}

.premium-table .table-empty svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    opacity: 0.5;
}

.premium-table .table-empty h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--stock-text);
    margin-bottom: 0.5rem;
}

.premium-table .table-empty p {
    font-size: 0.95rem;
    color: var(--stock-text-secondary);
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 768px) {
    .filter-drawer {
        width: 100%;
        max-width: 100vw;
    }

    .btn-add-icon {
        width: 44px;
        height: 44px;
    }

    .btn-add-icon svg {
        width: 20px;
        height: 20px;
    }

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

    .product-card {
        min-height: auto;
    }

    .product-actions {
        flex-wrap: wrap;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1400px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}