/* ==========================================================================
   THEME SYSTEM - Le Clos Hérault
   7 thèmes: wine, green, blue, gold, charcoal, light, dark
   ========================================================================== */

:root {
    /* Default theme variables - used by style.css */
    --primary: #722f37;
    --primary-hover: #5a252c;
    --color-primary: #722f37;
    --color-primary-hover: #5a252c;
    --bg-primary: #f8e8e8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --bg-card: #ffffff;
    --bg-hover: #f4f4f4;
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-muted: #555555;
    --text-light: #777777;
    --text-inverse: #ffffff;
    --border-color: #dddddd;
    --border-dark: #bbbbbb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --overlay-bg: rgba(0,0,0,0.5);
}

/* --------------------------------------------------------------------------
   THÈME WINE (Rouge Bordeaux)
   -------------------------------------------------------------------------- */
body.theme-wine {
    --primary: #722f37;
    --primary-hover: #5a252c;
    --color-primary: #722f37;
    --color-primary-hover: #5a252c;
    --bg-primary: #f8e8e8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --bg-card: #ffffff;
    --bg-hover: #f4f4f4;
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-muted: #555555;
    --text-light: #777777;
    --text-inverse: #ffffff;
    --border-color: #dddddd;
    --border-dark: #bbbbbb;
    --color-primary: var(--primary);
    --color-primary-hover: var(--primary-hover);
}

/* --------------------------------------------------------------------------
   THÈME GREEN (Vert Fort)
   -------------------------------------------------------------------------- */
body.theme-green {
    --primary: #2c5530;
    --primary-hover: #224025;
    --bg-primary: #e8f0e8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --bg-card: #ffffff;
    --bg-hover: #f4f4f4;
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-muted: #555555;
    --text-light: #777777;
    --text-inverse: #ffffff;
    --border-color: #dddddd;
    --border-dark: #bbbbbb;
    --color-primary: var(--primary);
    --color-primary-hover: var(--primary-hover);
}

/* --------------------------------------------------------------------------
   THÈME BLUE (Bleu Nuit)
   -------------------------------------------------------------------------- */
body.theme-blue {
    --primary: #1e3a5f;
    --primary-hover: #172d4a;
    --bg-primary: #e8ecf0;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --bg-card: #ffffff;
    --bg-hover: #f4f4f4;
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-muted: #555555;
    --text-light: #777777;
    --text-inverse: #ffffff;
    --border-color: #dddddd;
    --border-dark: #bbbbbb;
    --color-primary: var(--primary);
    --color-primary-hover: var(--primary-hover);
}

/* --------------------------------------------------------------------------
   THÈME GOLD (Or Élégant)
   -------------------------------------------------------------------------- */
body.theme-gold {
    --primary: #b8902f;
    --primary-hover: #9a7828;
    --bg-primary: #faf8e8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --bg-card: #ffffff;
    --bg-hover: #f4f4f4;
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-muted: #555555;
    --text-light: #777777;
    --text-inverse: #1a1a1a;
    --border-color: #dddddd;
    --border-dark: #bbbbbb;
}

/* --------------------------------------------------------------------------
   THÈME CHARCOAL (Charbon)
   -------------------------------------------------------------------------- */
body.theme-charcoal {
    --primary: #333333;
    --primary-hover: #1a1a1a;
    --bg-primary: #f0f0f0;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8e8;
    --bg-card: #ffffff;
    --bg-hover: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-muted: #555555;
    --text-light: #777777;
    --text-inverse: #ffffff;
    --border-color: #cccccc;
    --border-dark: #aaaaaa;
}

/* --------------------------------------------------------------------------
   THÈME LIGHT (Clair)
   -------------------------------------------------------------------------- */
body.theme-light {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f0f0f0;
    --bg-card: #ffffff;
    --bg-hover: #f4f4f4;
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-muted: #555555;
    --text-light: #777777;
    --text-inverse: #ffffff;
    --border-color: #e0e0e0;
    --border-dark: #cccccc;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* --------------------------------------------------------------------------
   THÈME DARK (Sombre)
   -------------------------------------------------------------------------- */
body.theme-dark {
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --bg-card: #1e1e1e;
    --bg-hover: #333333;
    --text-primary: #f0f0f0;
    --text-secondary: #d0d0d0;
    --text-muted: #aaaaaa;
    --text-light: #888888;
    --text-inverse: #121212;
    --border-color: #333333;
    --border-dark: #444444;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --overlay-bg: rgba(0,0,0,0.7);
}

/* --------------------------------------------------------------------------
   DARK MODE SPECIFIC OVERRIDES
   -------------------------------------------------------------------------- */
body.theme-dark .chip {
    background-color: #2a2a2a;
    color: #f0f0f0;
    border-color: #444444;
}

body.theme-dark .chip:hover {
    background-color: #333333;
}

body.theme-dark .product-card {
    background-color: #1e1e1e;
    border-color: #333333;
}

body.theme-dark .product-card h3 {
    color: #f0f0f0;
}

body.theme-dark .product-card .product-price {
    color: #d0d0d0;
}

body.theme-dark .category-tab {
    background: #222222;
    color: #f0f0f0;
    border-color: #333333;
}

body.theme-dark .category-tab:hover {
    background: #2a2a2a;
    border-color: #444444;
}

body.theme-dark .sort-select {
    background: #1e1e1e;
    color: #f0f0f0;
    border-color: #333333;
}

body.theme-dark .quick-add-btn {
    background: var(--primary);
    color: #fff;
}

body.theme-dark .quick-add-btn:hover {
    background: var(--primary-hover);
}

body.theme-dark .product-image {
    background: #2a2a2a;
}

body.theme-dark .pagination-btn {
    background: #1e1e1e;
    color: #f0f0f0;
    border-color: #333333;
}

body.theme-dark .pagination-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

body.theme-dark .pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-inverse);
}

/* --------------------------------------------------------------------------
   HEADER CONTRAST - DARK THEMES
   Logo text: Gold, Nav links: Silver for dark backgrounds
   -------------------------------------------------------------------------- */
body.theme-dark .header-top a.logo span.calligraphic-text {
    color: #d4af37;
}
body.theme-dark .header-top .desktop-nav > a {
    color: #c0c0c0;
}
body.theme-dark .header-top .desktop-nav > a:hover {
    color: #ffffff;
    background: #333333;
}

/* Charcoal theme - slightly warmer gold/silver */
body.theme-charcoal .header-top a.logo span.calligraphic-text {
    color: #e8c547;
}
body.theme-charcoal .header-top .desktop-nav > a {
    color: #d0d0d0;
}
body.theme-charcoal .header-top .desktop-nav > a:hover {
    color: #ffffff;
    background: #3a3a3a;
}

/* --------------------------------------------------------------------------
   PAGE LINKS - SHOP
   -------------------------------------------------------------------------- */
.page-links {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
}
.page-link {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}
.page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-inverse);
}
.page-ellipsis {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   GLOBAL THEME APPLICATION
   Apply theme variables to all common elements
   -------------------------------------------------------------------------- */
body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.main-content,
main,
.section,
.card,
.content-box {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

p, span, li {
    color: var(--text-secondary);
}

a {
    color: var(--primary);
}

a:hover {
    color: var(--primary-hover);
}

button, .btn, .button {
    background-color: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

button:hover, .btn:hover, .button:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

input, select, textarea {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
}

.border, hr, .divider {
    border-color: var(--border-color);
}

.bg-light, .bg-muted {
    background-color: var(--bg-tertiary);
}

.text-muted, .text-muted {
    color: var(--text-muted);
}

/* ==========================================================================
   E-COMMERCE DASHBOARD STYLES
   ========================================================================== */

.dashboard-header {
    margin-bottom: 30px;
}

.dashboard-header h1 {
    margin-bottom: 8px;
}

.welcome-message {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 4px solid var(--primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-card.kpi-revenue {
    border-left-color: #28a745;
}

.kpi-card.kpi-orders {
    border-left-color: #007bff;
}

.kpi-card.kpi-pending {
    border-left-color: #ffc107;
}

.kpi-card.kpi-affiliate {
    border-left-color: #6f42c1;
}

.kpi-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.kpi-content h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-value small {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.kpi-sub {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Dashboard sections */
.dashboard-section {
    margin-bottom: 30px;
}

.dashboard-section .large-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.dashboard-section .large-card h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.dashboard-card h3 {
    margin-bottom: 15px;
    font-size: 1.05rem;
}

.dashboard-card.large-card {
    grid-column: 1 / -1;
}

/* Charts */
.chart-container {
    width: 100%;
    height: 300px;
    position: relative;
}

/* Stock alerts */
.stock-alerts {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.stock-alerts li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.stock-alerts li:last-child {
    border-bottom: none;
}

.stock-alerts li strong {
    color: #dc3545;
}

/* Order list */
.order-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.order-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.order-list li:last-child {
    border-bottom: none;
}

.order-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-info strong {
    font-size: 0.95rem;
}

.order-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.order-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-paid {
    background: #d4edda;
    color: #155724;
}

.status-processing {
    background: #cce5ff;
    color: #004085;
}

.status-shipped {
    background: #d1ecf1;
    color: #0c5460;
}

.status-delivered {
    background: #d4edda;
    color: #155724;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.order-amount {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Top products */
.top-products-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.top-products-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.top-products-list li:last-child {
    border-bottom: none;
}

.top-products-list li strong {
    color: var(--primary);
}

.top-products-list li small {
    color: var(--text-muted);
}

/* Affiliate list */
.affiliate-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.affiliate-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.affiliate-list li:last-child {
    border-bottom: none;
}

.affiliate-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.affiliate-info strong {
    font-size: 0.95rem;
}

.affiliate-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.affiliate-commission {
    font-weight: 600;
    color: #6f42c1;
}

/* Buttons */
.button-sm {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    text-decoration: none;
    background: var(--primary);
    color: #fff;
    margin-top: 10px;
    transition: background 0.2s ease;
}

.button-sm:hover {
    background: var(--primary-hover);
}

/* Empty state */
.empty-state {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

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

    .kpi-value {
        font-size: 1.5rem;
    }

    .chart-container {
        height: 250px;
    }
}