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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
}

/* Navbar */
.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    font-size: 24px;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.nav-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* .btn-primary:hover removed */

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

/* .btn-secondary:hover removed */

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab:hover {
    color: #667eea;
}

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* View Container */
.view-container {
    display: none;
}

.view-container.active {
    display: block;
}

/* Table */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

th:hover {
    background: #e9ecef;
}

th:last-child {
    text-align: right;
    padding-right: 30px;
}

tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

tbody tr:hover {
    background: #f8f9fa;
}

td {
    padding: 15px;
    font-size: 14px;
    color: #333;
}

.product-name {
    font-weight: 600;
    color: #667eea;
}

.price {
    font-weight: 600;
    color: #333;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    z-index: 1000;
    border: 1px solid #e0e0e0;
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background-color: #f8f9fa;
}

.dropdown-content a:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-content a:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown.active .dropdown-content {
    display: block;
}

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.85);
    color: white;
    display: none; /* Caché par défaut */
    z-index: 9999;
    pointer-events: all;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    align-items: center;
    justify-content: center;
}

.loader-overlay.active {
    display: flex; /* Visible en flex quand actif */
}

.loader-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 24px;
    max-width: 420px;
    margin: 0 auto;
}

.loader-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.loader-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #7c83ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.view-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.view-count {
    font-size: 14px;
    color: #666;
    background: #f0f0f0;
    padding: 6px 12px;
    border-radius: 20px;
    min-width: 100px;
    text-align: center;
}

.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn-edit {
    background: #667eea;
    color: white;
}

.action-btn-edit:hover {
    background: #5568d3;
}

.action-btn-delete {
    background: #dc3545;
    color: white;
}

.action-btn-delete:hover {
    background: #c82333;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    background: white;
    color: #333;
    font-weight: 600;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #eee;
}

.toast.success {
    border-left: 5px solid #38ef7d;
}

.toast.success .material-symbols-rounded {
    color: #38ef7d;
}

.toast.error {
    border-left: 5px solid #eb3349;
}

.toast.error .material-symbols-rounded {
    color: #eb3349;
}

.toast.info {
    border-left: 5px solid #11998e;
}

.toast.info .material-symbols-rounded {
    color: #11998e;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c83ff 0%, #a855f7 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: inherit;
}

.loader-text {
    color: white;
    font-size: 14px;
    font-weight: 600;
    min-height: 18px;
}

/* Scroll to Top Button */
#scrollTopBtn {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99;
    font-size: 20px;
    border: none;
    outline: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

#scrollTopBtn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Unified Hover Effect for All Buttons */
button:not(.modal-close):not(.btn-remove):not(.tab):not(#clearSearch),
.btn:not(.modal-close):not(.btn-remove):not(.tab):not(#clearSearch) {
    transition: all 0.3s ease !important;
}

button:not(.modal-close):not(.btn-remove):not(.tab):not(#clearSearch):hover,
.btn:not(.modal-close):not(.btn-remove):not(.tab):not(#clearSearch):hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
    filter: brightness(1.05);
    cursor: pointer;
}

/* Material Symbols Alignment */
.material-symbols-rounded {
    vertical-align: middle;
    font-size: 20px; /* Default size */
}

button .material-symbols-rounded {
    font-size: 18px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    min-width: 32px;
    height: 32px;
}

.action-btn .material-symbols-rounded {
    font-size: 16px;
}

.logo-icon {
    font-size: 24px;
    color: #667eea;
}

/* ========== RESPONSIVE MOBILE ========== */

/* Par défaut : mobile-only caché sur desktop */
.mobile-only { display: none; }

@media (max-width: 768px) {

    /* Cacher sur mobile */
    .hide-mobile { display: none !important; }

    /* Afficher les éléments mobile-only */
    .mobile-only { display: block; }

    .navbar {
        padding: 10px 16px;
    }

    .nav-actions {
        gap: 6px;
    }

    /* Cacher les textes des boutons navbar, garder les icônes */
    .btn-label {
        display: none;
    }

    .btn {
        padding: 8px 10px;
        font-size: 13px;
    }

    .container {
        padding: 12px;
    }

    /* Stats grid: 2 colonnes sur mobile */
    .container > div[style*="grid-template-columns"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Tabs: scroll horizontal */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar { display: none; }

    .tab {
        padding: 10px 16px;
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Tableau: scroll horizontal */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 580px;
    }

    th, td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .view-title {
        font-size: 18px;
    }

    .toast {
        top: auto;
        bottom: 16px;
        right: 12px;
        left: 12px;
        font-size: 13px;
    }

    #scrollTopBtn {
        bottom: 70px;
        right: 16px;
        width: 42px;
        height: 42px;
        padding: 10px;
    }
}

@media (max-width: 480px) {

    /* Stats: 1 colonne sur très petit écran */
    .container > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .brand-name {
        font-size: 16px;
    }
}
