/**
 * SGMB - Système de Gestion Multi-Boutiques
 * Styles personnalisés
 */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --navbar-height: 60px;
    --primary-color: #007bff;
    --sidebar-bg: #212529;
    --sidebar-text: #adb5bd;
    --sidebar-active: #ffffff;
    
    /* Light theme (default) */
    --bg-body: #f8f9fa;
    --bg-card: #ffffff;
    --bg-card-header: #ffffff;
    --bg-input: #ffffff;
    --bg-table-header: #f8f9fa;
    --bg-hover: #f8f9fa;
    --bg-quick-action: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 2px 15px rgba(0, 0, 0, 0.08);
}

/* Dark theme */
html[data-theme="dark"] {
    --bg-body: #1a1d21;
    --bg-card: #212529;
    --bg-card-header: #2d3238;
    --bg-input: #2d3238;
    --bg-table-header: #2d3238;
    --bg-hover: #2d3238;
    --bg-quick-action: #2d3238;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --text-muted: #6c757d;
    --border-color: #495057;
    --border-light: #343a40;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 15px rgba(0, 0, 0, 0.3);
}

/* Base body styles */
body {
    background-color: var(--bg-body) !important;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Transition pour tous les éléments */
*, *::before, *::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.2s ease;
}

[data-theme="dark"] .card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .card-header {
    background-color: var(--bg-card-header);
    border-color: var(--border-light);
    color: var(--text-primary);
}

[data-theme="dark"] .card-body {
    color: var(--text-primary);
}

[data-theme="dark"] .table {
    --bs-table-bg: var(--bg-card);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-light);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.075);
    color: var(--text-primary);
}

[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: var(--bg-card);
    border-bottom-color: var(--border-light);
    color: var(--text-primary);
}

[data-theme="dark"] .table th {
    background-color: var(--bg-table-header) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .table td {
    background-color: var(--bg-card);
    border-color: var(--border-light) !important;
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: var(--bg-hover) !important;
}

[data-theme="dark"] .table-responsive {
    border-color: var(--border-light);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--bg-input);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .form-label {
    color: var(--text-primary);
}

[data-theme="dark"] .input-group-text {
    background-color: var(--bg-card-header);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .navbar {
    background-color: var(--bg-card) !important;
    border-color: var(--border-light);
}

[data-theme="dark"] .navbar .nav-link {
    color: var(--text-secondary);
}

[data-theme="dark"] .navbar .nav-link:hover {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-divider {
    border-color: var(--border-light);
}

[data-theme="dark"] .modal-content {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .modal-header {
    border-color: var(--border-light);
}

[data-theme="dark"] .modal-header .modal-title {
    color: var(--text-primary);
}

[data-theme="dark"] .modal-footer {
    border-color: var(--border-light);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .footer {
    background-color: var(--bg-card) !important;
    color: var(--text-secondary);
}

[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--bg-card-header) !important;
}

[data-theme="dark"] .bg-white {
    background-color: var(--bg-card) !important;
}

[data-theme="dark"] .border {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .border-bottom {
    border-color: var(--border-light) !important;
}

[data-theme="dark"] .list-group-item {
    background-color: var(--bg-card);
    border-color: var(--border-light);
    color: var(--text-primary);
}

[data-theme="dark"] .alert-info {
    background-color: rgba(13, 202, 240, 0.15);
    border-color: rgba(13, 202, 240, 0.3);
    color: #6edff6;
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.3);
    color: #ffda6a;
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.3);
    color: #ea868f;
}

[data-theme="dark"] .alert-success {
    background-color: rgba(25, 135, 84, 0.15);
    border-color: rgba(25, 135, 84, 0.3);
    color: #75b798;
}

[data-theme="dark"] .quick-action {
    background-color: var(--bg-quick-action);
    color: var(--text-primary);
}

[data-theme="dark"] .quick-action:hover {
    background-color: var(--bg-card);
    border-color: var(--primary-color);
}

[data-theme="dark"] .dashboard-widget {
    background-color: var(--bg-card);
}

[data-theme="dark"] .dashboard-widget .card-header {
    border-color: var(--border-light);
}

[data-theme="dark"] .activity-timeline::before {
    background-color: var(--border-color);
}

[data-theme="dark"] .top-product-item {
    border-color: var(--border-light);
}

[data-theme="dark"] .top-product-rank.default {
    background-color: var(--bg-card-header);
    color: var(--text-secondary);
}

[data-theme="dark"] .breadcrumb {
    background-color: transparent;
}

[data-theme="dark"] .breadcrumb-item a {
    color: var(--text-secondary);
}

[data-theme="dark"] .breadcrumb-item.active {
    color: var(--text-muted);
}

[data-theme="dark"] .page-link {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .page-link:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="dark"] .page-item.disabled .page-link {
    background-color: var(--bg-card-header);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.25rem;
    transition: color 0.2s ease;
}

.theme-toggle:hover {
    color: var(--text-primary);
}

[data-theme="dark"] .theme-toggle {
    color: #ffc107;
}

[data-theme="dark"] .theme-toggle:hover {
    color: #ffda6a;
}

/* Auth pages dark mode */
[data-theme="dark"] .auth-wrapper {
    background: linear-gradient(135deg, #1e1e2e 0%, #2d1b4e 100%);
}

[data-theme="dark"] .auth-card {
    background: var(--bg-card);
}

[data-theme="dark"] .auth-header {
    background: var(--bg-card-header);
}

[data-theme="dark"] .auth-header h4 {
    color: var(--text-primary);
}

[data-theme="dark"] .auth-body {
    color: var(--text-primary);
}

[data-theme="dark"] .auth-body h5 {
    color: var(--text-primary);
}

/* ================================
   Layout principal
   ================================ */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ================================
   Sidebar
   ================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-right: 10px;
}

.sidebar-brand-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
}

.sidebar-close {
    display: none;
}

/* Navigation sidebar */
.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-item {
    margin-bottom: 2px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-active);
}

.sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-active);
    border-left-color: var(--primary-color);
}

.sidebar-nav .nav-link i {
    width: 24px;
    margin-right: 10px;
    font-size: 1.1rem;
}

.sidebar-nav .nav-link .bi-chevron-down {
    transition: transform 0.2s ease;
}

.sidebar-nav .nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

/* Sous-menu */
.sidebar-nav .collapse .nav-link {
    padding-left: 1.5rem;
    font-size: 0.9rem;
}

/* ================================
   Navbar
   ================================ */
.navbar {
    height: var(--navbar-height);
    position: sticky;
    top: 0;
    z-index: 1030;
    background-color: var(--bg-card) !important;
}

.navbar .dropdown-menu {
    z-index: 1050;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid var(--border-light);
}

.navbar .dropdown-item {
    border-radius: 6px;
    margin: 2px 8px;
    width: calc(100% - 16px);
}

.navbar .dropdown-item:hover {
    background-color: var(--bg-hover);
}

.navbar-brand {
    font-weight: 600;
}

/* Navbar mobile optimizations */
@media (max-width: 991.98px) {
    .navbar {
        height: auto;
        min-height: 50px;
        padding: 0.5rem 0;
    }
    
    .navbar .dropdown-item {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand {
        font-size: 0.9rem !important;
        max-width: 120px !important;
    }
}

/* Fix main content scroll with sticky navbar */
.main-content > main {
    flex: 1;
}

/* ================================
   Footer
   ================================ */
.footer {
    margin-top: auto;
}

/* ================================
   Auth pages (login)
   ================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.auth-header {
    text-align: center;
    padding: 2rem 2rem 1rem;
    background: #f8f9fa;
}

.auth-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.auth-body {
    padding: 2rem;
}

/* ================================
   Cards et composants
   ================================ */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

/* Stats cards */
.stat-card {
    border: none;
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card.primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.stat-card.success {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.stat-card.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.stat-card.danger {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
}

.stat-card.info {
    background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
}

.stat-card.purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

.stat-card.orange {
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
}

.stat-card.teal {
    background: linear-gradient(135deg, #14b8a6 0%, #2dd4bf 100%);
}

.stat-card.pink {
    background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
}

.stat-card.indigo {
    background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%);
}

.stat-card.cyan {
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
}

.stat-card.rose {
    background: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%);
}

.stat-card .card-body {
    color: #fff;
    padding: 1rem;
}

.stat-card .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.stat-card h6 {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem !important;
}

.stat-card h3 {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 0.25rem !important;
}

.stat-card h4 {
    font-weight: 700;
    font-size: 1.25rem;
}

.stat-card small {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.75rem;
}

.stat-card .stat-trend {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 0.375rem;
    background: rgba(255, 255, 255, 0.2);
    display: inline-block;
}

.stat-card .stat-trend.up {
    color: #d1fae5;
}

.stat-card .stat-trend.down {
    color: #fee2e2;
}

/* Responsive stat cards */
@media (max-width: 575.98px) {
    .stat-card .card-body {
        padding: 0.75rem;
    }
    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    .stat-card h3 {
        font-size: 1.1rem;
    }
    .stat-card h4 {
        font-size: 1rem;
    }
    .stat-card h6 {
        font-size: 0.65rem;
    }
    .stat-card small {
        font-size: 0.65rem;
    }
}

/* Dashboard widgets */
.dashboard-widget {
    border-radius: 1rem;
    border: none;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.dashboard-widget:hover {
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.12);
}

.dashboard-widget .card-header {
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
    padding: 0.875rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.dashboard-widget .card-header i {
    font-size: 1rem;
}

.dashboard-widget .card-body {
    padding: 1rem;
}

@media (max-width: 575.98px) {
    .dashboard-widget .card-header {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    .dashboard-widget .card-body {
        padding: 0.75rem;
    }
    .dashboard-widget .table {
        font-size: 0.8rem;
    }
}

/* Quick actions */
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 0.75rem;
    border-radius: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    background: #f8f9fa;
    border: 2px solid transparent;
    height: 100%;
}

.quick-action:hover {
    background: #fff;
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 123, 255, 0.15);
}

.quick-action i {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.quick-action span {
    font-weight: 500;
    font-size: 0.8rem;
    text-align: center;
}

@media (max-width: 575.98px) {
    .quick-action {
        padding: 1rem 0.5rem;
    }
    .quick-action i {
        font-size: 1.5rem;
    }
    .quick-action span {
        font-size: 0.7rem;
    }
}

/* Activity timeline */
.activity-timeline {
    position: relative;
    padding-left: 25px;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.activity-item {
    position: relative;
    padding-bottom: 1rem;
    font-size: 0.85rem;
}

.activity-item:last-child {
    padding-bottom: 0;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.activity-item.success::before {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.activity-item.warning::before {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.activity-item.danger::before {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

@media (max-width: 575.98px) {
    .activity-item {
        font-size: 0.75rem;
    }
    .activity-item .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Progress bars */
.progress-thin {
    height: 6px;
    border-radius: 3px;
}

/* Top products */
.top-product-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}

.top-product-item:last-child {
    border-bottom: none;
}

.top-product-rank {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.top-product-rank.gold {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #fff;
}

.top-product-rank.silver {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: #fff;
}

.top-product-rank.bronze {
    background: linear-gradient(135deg, #d97706 0%, #92400e 100%);
    color: #fff;
}

.top-product-rank.default {
    background: #f3f4f6;
    color: #6b7280;
}

@media (max-width: 575.98px) {
    .top-product-item {
        font-size: 0.75rem;
    }
    .top-product-rank {
        width: 22px;
        height: 22px;
        font-size: 0.65rem;
        margin-right: 0.5rem;
    }
}

/* Welcome banner */
.welcome-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 1.25rem;
    padding: 2rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-slow 4s ease-in-out infinite;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

@keyframes pulse-slow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.welcome-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    backdrop-filter: blur(10px);
}

.welcome-banner h2 {
    font-weight: 700;
    font-size: 1.75rem;
}

.welcome-banner p {
    font-size: 1rem;
}

.welcome-date {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.75rem 1.25rem;
    border-radius: 1rem;
    backdrop-filter: blur(10px);
}

.welcome-date .date-day {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.welcome-date .date-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.welcome-date .date-month {
    font-weight: 600;
    text-transform: capitalize;
}

.welcome-date .date-weekday {
    opacity: 0.8;
    font-size: 0.85rem;
    text-transform: capitalize;
}

@media (max-width: 767.98px) {
    .welcome-banner {
        padding: 1.25rem;
        text-align: center;
    }
    .welcome-banner .d-flex {
        flex-direction: column;
        text-align: center;
    }
    .welcome-icon {
        margin: 0 auto 1rem !important;
    }
    .welcome-banner h2 {
        font-size: 1.35rem;
    }
    .welcome-date {
        justify-content: center;
        margin-top: 1rem;
    }
}

/* Chart placeholder */
.chart-container {
    position: relative;
    height: 250px;
}

/* Custom text colors */
.text-purple {
    color: #764ba2 !important;
}

.text-orange {
    color: #fd7e14 !important;
}

.text-teal {
    color: #20c997 !important;
}

/* ================================
   Tables
   ================================ */
.table-responsive {
    border-radius: 0.5rem;
}

.table th {
    font-weight: 600;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.table-hover tbody tr:hover {
    background: #f8f9fa;
}

/* ================================
   Buttons
   ================================ */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ================================
   Forms
   ================================ */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.375rem;
}

/* ================================
   Badges
   ================================ */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    /* Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1030;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

/* ================================
   Utilitaires
   ================================ */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Animation */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stock alerts */
.stock-danger {
    color: #dc3545;
    font-weight: 600;
}

.stock-warning {
    color: #ffc107;
    font-weight: 600;
}

.stock-success {
    color: #28a745;
}

/* Print styles */
@media print {
    .sidebar,
    .navbar,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* ================================
   Point de vente cards
   ================================ */
.point-vente-card {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.point-vente-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.point-vente-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.point-vente-icon-sm {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.stat-mini {
    transition: all 0.2s ease;
}

.stat-mini:hover {
    transform: scale(1.02);
}

[data-theme="dark"] .stat-mini {
    background-color: var(--bg-card-header) !important;
}

[data-theme="dark"] .point-vente-card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .point-vente-card .card-footer {
    border-color: var(--border-light);
}

/* Empty state */
.empty-state {
    padding: 2rem;
}

.empty-state-icon {
    opacity: 0.5;
}

/* Form improvements */
.form-card {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.form-card .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 1rem 1rem 0 0 !important;
    padding: 1.25rem 1.5rem;
}

.form-card .card-header i {
    font-size: 1.25rem;
}

.form-section {
    background: var(--bg-card-header);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-section-title {
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

[data-theme="dark"] .form-section {
    background: var(--bg-card-header);
}

/* ================================
   User cards
   ================================ */
.user-card {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.user-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.avatar-initials {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
}

.avatar-initials-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 2px solid #fff;
    border-radius: 50%;
}

.user-avatar {
    position: relative;
}

[data-theme="dark"] .user-card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .user-card .card-footer {
    border-color: var(--border-light);
}

[data-theme="dark"] .online-indicator {
    border-color: var(--bg-card);
}

/* ================================
   Role cards
   ================================ */
.role-card {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.role-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.role-icon {
    width: 50px;
    height: 50px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    flex-shrink: 0;
}

[data-theme="dark"] .role-card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .role-card .card-footer {
    border-color: var(--border-light);
}

/* Permission cards */
.permission-card {
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.permission-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.permission-card .card-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid var(--border-light);
    padding: 0.75rem 1rem;
}

.permission-card .card-body {
    padding: 0.75rem 1rem;
    max-height: 200px;
    overflow-y: auto;
}

[data-theme="dark"] .permission-card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .permission-card .card-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-color: var(--border-light);
}

/* ================================
   Product cards
   ================================ */
.product-card {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.product-card.border-warning {
    border: 2px solid var(--bs-warning) !important;
}

.product-image {
    width: 60px;
    height: 60px;
    border-radius: 0.75rem;
    object-fit: cover;
    flex-shrink: 0;
}

.product-image-placeholder {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.product-icon-sm {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

[data-theme="dark"] .product-card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .product-card .card-footer {
    border-color: var(--border-light);
}

[data-theme="dark"] .product-card .bg-light {
    background-color: var(--bg-card-header) !important;
}

/* ================================
   Category cards
   ================================ */
.category-card {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.category-icon {
    width: 50px;
    height: 50px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.category-icon-sm {
    width: 35px;
    height: 35px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
    flex-shrink: 0;
}

[data-theme="dark"] .category-card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .category-card .card-footer {
    border-color: var(--border-light);
}

/* ================================
   Contact cards (clients/fournisseurs)
   ================================ */
.contact-card {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.contact-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.contact-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.contact-avatar.supplier {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.contact-avatar-sm {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.contact-avatar-sm.supplier {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.contact-info a {
    color: inherit;
    text-decoration: none;
}

.contact-info a:hover {
    color: var(--bs-primary);
}

[data-theme="dark"] .contact-card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .contact-card .card-footer {
    border-color: var(--border-light);
}

[data-theme="dark"] .contact-card .bg-light {
    background-color: var(--bg-card-header) !important;
}

/* ================================
   Purchase/Sale icons
   ================================ */
.purchase-icon,
.sale-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.purchase-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.sale-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.return-icon {
    width: 45px;
    height: 45px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* ================================
   Responsive Tables - Mobile & Tablet
   ================================ */
@media (max-width: 991.98px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table th,
    .table td {
        white-space: nowrap;
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .table .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .table .badge {
        font-size: 0.7rem;
    }
}

@media (max-width: 767.98px) {
    .table th,
    .table td {
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
    }
    
    .table .btn-group .btn {
        padding: 0.2rem 0.4rem;
    }
    
    .table .d-flex.gap-1 {
        gap: 0.25rem !important;
    }
    
    .stat-card .stat-value,
    .stat-card h3 {
        font-size: 1.25rem;
    }
    
    .stat-card h6 {
        font-size: 0.75rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .table th,
    .table td {
        font-size: 0.75rem;
        padding: 0.35rem 0.4rem;
    }
    
    .table .btn-sm {
        padding: 0.15rem 0.35rem;
        font-size: 0.7rem;
    }
    
    .table .btn-sm i {
        font-size: 0.7rem;
    }
    
    .table .btn-sm .me-1 {
        margin-right: 0 !important;
    }
    
    .table .btn-sm span:not(.visually-hidden) {
        display: none;
    }
    
    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .stat-card .stat-value,
    .stat-card h3 {
        font-size: 1rem;
    }
    
    h4, .h4 {
        font-size: 1.1rem;
    }
    
    .page-header h4 {
        font-size: 1rem;
    }
    
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* ================================
   Dashboard Mobile Fixes
   ================================ */
@media (max-width: 767.98px) {
    .welcome-banner {
        padding: 1rem !important;
        overflow: hidden;
    }
    
    .welcome-banner h2 {
        font-size: 1.25rem;
    }
    
    .welcome-banner p {
        font-size: 0.85rem;
    }
    
    .welcome-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .welcome-date {
        display: none;
    }
    
    .stat-card .card-body {
        padding: 0.75rem;
    }
    
    .stat-card h3 {
        font-size: 1.1rem;
        word-break: break-word;
    }
    
    .stat-card h6 {
        font-size: 0.75rem;
    }
    
    .stat-card .stat-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .stat-card small {
        font-size: 0.7rem;
    }
    
    .stat-trend {
        font-size: 0.7rem;
    }
    
    .quick-action {
        padding: 0.5rem;
    }
    
    .quick-action i {
        font-size: 1.25rem;
    }
    
    .quick-action span {
        font-size: 0.7rem;
    }
    
    .top-product-item {
        padding: 0.5rem 0;
    }
    
    .top-product-rank {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
    
    .chart-container {
        height: 200px !important;
    }
    
    .dashboard-widget .card-header {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 575.98px) {
    .welcome-banner {
        padding: 0.75rem !important;
    }
    
    .welcome-banner h2 {
        font-size: 1.1rem;
    }
    
    .welcome-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .stat-card h3 {
        font-size: 0.95rem;
    }
    
    .stat-card .stat-icon {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    
    .quick-action i {
        font-size: 1rem;
    }
    
    .chart-container {
        height: 180px !important;
    }
}

/* Prevent horizontal overflow - but allow dropdown to show */
.main-content {
    overflow-x: clip;
}

.container-fluid {
    overflow-x: clip;
}

/* Ensure navbar dropdown appears above everything */
.navbar {
    overflow: visible !important;
}

.navbar .dropdown {
    position: static;
}

.navbar .dropdown-menu {
    position: absolute;
    z-index: 1060;
}

/* ================================
   Mobile Bottom Navigation
   ================================ */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0));
    z-index: 1040;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 60px;
}

.mobile-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.mobile-nav-item span {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
    color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

.mobile-nav-item.active {
    color: var(--primary-color);
}

.mobile-nav-item.active i {
    font-weight: bold;
}

/* Add padding to main content when mobile nav is visible */
@media (max-width: 991.98px) {
    .main-content {
        padding-bottom: 70px;
    }
}

/* Dark mode support */
[data-theme="dark"] .mobile-bottom-nav {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

[data-theme="dark"] .mobile-nav-item:hover,
[data-theme="dark"] .mobile-nav-item:focus {
    background: rgba(255, 255, 255, 0.1);
}
