/* Import Montserrat Font */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

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

/* Force dark theme immediately */
html, body {
    background-color: #0a0a0a !important;
    color: #ffffff !important;
}

:root {
    --primary-color: #FFD700;
    --primary-dark: #e6c200;
    --secondary-color: #87DCD5;
    --danger-color: #ef4444;
    --success-color: #00ff88;
    --bg-main: #0a0a0a;
    --card-bg: #111;
    --card-border: #222;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --text-hover: #e0e0e0;
    --border-color: #222;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

html {
    background-color: #0a0a0a;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #0a0a0a;
    background-color: var(--bg-main);
    color: #ffffff;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ==================== PROJECT SELECTION SCREEN ==================== */
.project-selection-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.project-selection-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 500px;
    padding: 40px;
    position: relative;
    z-index: 1001;
    pointer-events: auto;
}

.project-selection-logo {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.project-selection-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.project-selection-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
}

.project-select {
    width: 400px;
    margin-bottom: 0 !important;
    position: relative;
    z-index: 1001;
    pointer-events: auto;
}

.project-select .custom-select-button {
    width: 100%;
    height: 50px;
    font-size: 16px;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 10001;
}

.project-select .custom-select-dropdown {
    position: absolute;
    z-index: 1002 !important;
    pointer-events: auto !important;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    width: 100%;
}

.project-selection-logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    margin-top: 20px;
    background: transparent;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
}

.project-selection-logout-btn:hover {
    color: var(--text-primary);
    border-color: var(--primary-color);
    background: rgba(255, 215, 0, 0.1);
}

/* Dashboard main hidden by default */
.dashboard-main {
    display: none;
    width: 100%;
    min-height: 100vh;
}

.dashboard-main.active {
    display: flex;
}

/* ==================== SIDEBAR FIXE ==================== */
.sidebar-left {
    position: fixed;
    left: 0;
    top: 0;
    width: 235px;
    height: 100vh;
    background-color: #111;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid #222;
}

.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #222;
}

.sidebar-logo-img {
    max-width: 150px;
    width: 100%;
    height: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    color: #888;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidebar-item:hover {
    color: #fff;
    background-color: #1a1a1a;
}

.sidebar-item.active {
    background-color: #1a1a1a;
    color: #FFD700;
    border-left: 3px solid #FFD700;
}

.sidebar-item.active .sidebar-icon {
    stroke: #FFD700;
}

.sidebar-icon {
    display: block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-item span {
    font-size: 14px;
    font-weight: 500;
}

.badge-beta {
    display: inline-block;
    background: #FFD700;
    color: #000;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    letter-spacing: 0.5px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #222;
}

.sidebar-user {
    padding: 12px 20px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    transition: color 0.2s ease;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 500;
}

.sidebar-logout:hover {
    color: #fff;
}

/* ==================== CONTENU PRINCIPAL ==================== */
.main-wrapper {
    margin-left: 235px;
    min-height: 100vh;
    background-color: var(--bg-main);
    flex: 1;
    width: calc(100% - 235px);
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px 40px;
    background-color: var(--bg-main);
    border-bottom: 1px solid #222;
}

.main-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    position: relative;
}

/* === ZONE DE CONTENU PRINCIPALE === */
.main-content {
    padding: 40px;
    min-height: 100vh;
}

/* Hide site management buttons by default (Accueil section is default) */
.site-header > div:last-child {
    display: none !important;
}

/* Force hide site management buttons */
#viewSnippetBtn,
#manageCollaboratorsBtn,
#deleteSiteBtn {
    display: none !important;
}

/* === HEADER DE PAGE === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.page-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
}

/* === GRILLE DE CARTES STATS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* === CARTES DE STATISTIQUES === */
.stats-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #151515 100%);
    border: 1px solid #222;
    border-radius: 16px;
    padding: 28px 24px;
    transition: all 0.3s ease;
}

.stats-card:hover {
    border-color: #FFD700;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.1);
}

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

.stats-card-title {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-card-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.stats-card-value {
    font-size: 38px;
    font-weight: 700;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin: 0 0 8px 0;
}

.stats-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* === SECTION STATUT (grande carte) === */
.status-section {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 32px;
    min-height: 400px;
    transition: border-color 0.2s ease;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid #222;
}

.status-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.status-title {
    font-size: 24px;
    font-weight: 600;
    color: #FFD700;
    margin: 0;
}

.status-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 4px 0 0 36px;
}

.status-link {
    font-size: 14px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.status-link:hover {
    color: var(--primary-color);
}

/* === ÉTAT VIDE (Empty State) === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    opacity: 0.2;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.empty-state-description {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0 0 32px 0;
    max-width: 500px;
}

/* === GRILLE DE CARTES D'ACTION === */
.action-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

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

/* === CARTES D'ACTION === */
.action-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #151515 100%);
    border: 1px solid #222;
    border-radius: 16px;
    padding: 32px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.action-card:hover {
    border-color: #FFD700;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.1);
}

.action-card-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.action-card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-card-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Responsive images and SVG */
img, svg {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal scroll */
html {
    overflow-x: hidden;
}

/* Ensure containers don't overflow */
.dashboard-main,
.table-container {
    max-width: 100%;
}

/* Typography - Headings */
h1 {
    color: #ffffff;
}

h2, h3 {
    color: var(--primary-color);
}

/* Auth Page Styles */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0C090A 0%, #889292 100%);
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 450px;
}

.auth-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    margin-bottom: 20px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-form h2 {
    font-size: 24px;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: border-color 0.3s;
}

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

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Password field with toggle button */
.password-field {
    position: relative;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    z-index: 10;
}

.toggle-password:hover {
    color: var(--primary-color);
}

.toggle-password:focus {
    outline: none;
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

/* Auth buttons container */
.auth-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-buttons .btn {
    flex: 1;
}

/* Outline button style */
.btn-outline-primary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-outline-primary:hover {
    background-color: rgba(255, 215, 0, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.btn-outline-primary:disabled {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

/* Form description text */
.form-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    text-align: center;
    font-family: 'Montserrat', sans-serif;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #000000;
    border-radius: 8px;
    padding: 12px 24px;
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: #ffe033;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.btn-primary:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: #ffffff;
    color: #000000;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
    color: #000000;
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-loader {
    display: inline-block;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-footer {
    text-align: center;
    color: white;
    font-size: 14px;
}

.error-message {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.success-message {
    background-color: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Dashboard Styles */
.dashboard-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    padding: 16px 24px;
    box-shadow: var(--shadow);
}

.header-content {
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.header-content h1 {
    font-size: 24px;
    color: var(--text-primary);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user span {
    color: var(--text-secondary);
    font-size: 14px;
}

.dashboard-container {
    display: flex;
    flex: 1;
    width: 100%;
}

.dashboard-sidebar {
    display: none;
}

/* Navigation Sidebar */
.navigation-sidebar {
    width: 220px;
    background: var(--card-bg);
    border-right: 2px solid var(--border-color);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(252, 209, 22, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: transparent;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-icon {
    flex-shrink: 0;
}

.nav-item span {
    font-size: 15px;
}

/* Content Sections */
.content-section {
    width: 100%;
}

.clients-list {
    margin-bottom: 20px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.client-item {
    padding: 12px;
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background-color: var(--bg-color);
}

.client-item:hover {
    border-color: var(--primary-color);
    background-color: rgba(252, 209, 22, 0.1);
}

.client-item.active {
    border-color: var(--primary-color);
    background-color: rgba(252, 209, 22, 0.15);
}

.client-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 14px;
}

.client-url {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Custom Select Dropdown */
.custom-select-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.custom-select-wrapper.header-select {
    position: relative;
    width: 300px;
    margin-bottom: 0;
    z-index: 9998;
}

.custom-select-button {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #1a1a1a;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.header-select .custom-select-button {
    padding: 8px 12px;
    font-size: 14px;
    height: 40px;
    display: inline-flex;
    align-items: center;
}

.custom-select-button:hover {
    background: rgba(252, 209, 22, 0.05);
}

.custom-select-button.open {
    background: rgba(252, 209, 22, 0.1);
}

.custom-select-button .select-arrow {
    transition: transform 0.3s ease;
}

.custom-select-button.open .select-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 99999;
    max-height: 400px;
    overflow-y: auto;
}

/* Le dropdown est contrôlé via l'attribut style en JavaScript */

.custom-select-options {
    padding: 4px;
}

.custom-option {
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.custom-option:hover:not(.disabled):not(.placeholder) {
    background: rgba(252, 209, 22, 0.1);
}

.custom-option.selected {
    background: rgba(252, 209, 22, 0.15);
}

.custom-option.disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.custom-option.placeholder {
    color: var(--text-secondary);
    font-style: italic;
    cursor: default;
}

.custom-option.add-new {
    color: var(--primary-color);
    font-weight: 600;
    border-top: 2px solid var(--primary-color);
    margin-top: 8px;
    padding-top: 14px;
}

.custom-option.add-new:hover {
    background: rgba(252, 209, 22, 0.2);
}

.option-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
    font-size: 14px;
}

.option-url {
    font-size: 12px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 20px;
}

.dashboard-main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.welcome-message h2 {
    font-size: 28px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 16px;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 16px;
}

.site-header h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.site-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #151515 100%);
    padding: 28px 24px;
    border-radius: 16px;
    border: 1px solid #222;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #FFD700;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.1);
}

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

.stat-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.stat-content h3 {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 38px;
    font-weight: 700;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.filters-section,
.visualization-section,
.table-section {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    padding: 24px;
    transition: border-color 0.2s ease;
}

/* filters-section needs overflow visible so dropdowns aren't clipped */
.filters-section {
    overflow: visible;
}

.visualization-section,
.table-section {
    overflow: hidden;
}

.filters-section:hover,
.visualization-section:hover,
.table-section:hover {
    border-color: #333;
}

.filters-section h3,
.visualization-section h3,
.table-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #FFD700;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #222;
}

/* Category Distribution Bars */
.category-bars-section {
    background: #111;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #222;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    transition: border-color 0.2s ease;
}

.category-bars-section:hover {
    border-color: #333;
}

.category-bar-container {
    margin-bottom: 24px;
}

.category-bar-container:last-child {
    margin-bottom: 0;
}

.category-bar-container h4 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #FFD700;
    font-weight: 600;
}

.category-bar-wrapper {
    margin-bottom: 12px;
}

.category-bar {
    width: 100%;
    height: 40px;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    position: relative;
}

.category-bar .bar-loading {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.category-bar-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.category-bar-segment:hover {
    opacity: 0.85;
}

.category-bar-segment span {
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.category-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
}

.category-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.category-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.category-legend-label {
    font-weight: 500;
}

.category-legend-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Category bar tooltip */
.category-bar-tooltip {
    position: fixed;
    display: none;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 250px;
}

.tooltip-category-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.tooltip-category-info {
    font-size: 12px;
    opacity: 0.9;
}

/* === CONTENEUR DES FILTRES === */
.filters-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 20px;
    flex-wrap: wrap;
}

/* === BOUTONS DE FILTRE === */
.filter-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 400;
    font-family: 'Montserrat', sans-serif;
    background: #222;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* Effet hover */
.filter-button:hover {
    background: #2a2a2a;
    border-color: #FFD700;
}

/* Quand le filtre est actif/sélectionné */
.filter-button.active {
    background: #FFD700;
    color: #000;
    border-color: #FFD700;
    font-weight: 600;
}

/* Boutons d'action (Appliquer et Réinitialiser) */
#applyFiltersBtn,
#resetFiltersBtn {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
    font-weight: 500;
}

#applyFiltersBtn:hover,
#resetFiltersBtn:hover {
    background: #ffe033;
    border-color: #ffe033;
}

/* Icône de dropdown (flèche) */
.filter-button-icon {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

/* Rotation de la flèche quand ouvert */
.filter-button.open .filter-button-icon {
    transform: rotate(180deg);
}

/* === SECTION RÉSULTATS (à droite) === */
.filters-results {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: auto;
}

.results-count {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.results-count-icon {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

/* === DROPDOWN DE TRI === */
.sort-dropdown {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid currentColor;
    border-radius: 6px;
    font-size: 14px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-dropdown:hover {
    transform: translateY(-1px);
    opacity: 0.8;
}

/* === DROPDOWN PERSONNALISÉ === */
.filter-dropdown-wrapper {
    position: relative;
}

/* Fixed widths for each filter button to prevent resizing */
#dateRangeBtn {
    min-width: 180px;
}

#deviceFilterBtn {
    min-width: 160px;
}

#trafficSourceFilterBtn {
    min-width: 180px;
}

#categoryFilterBtn {
    min-width: 180px;
}

#depthFilterBtn {
    min-width: 100px;
}

#resetFiltersBtn {
    min-width: 120px;
}

.filter-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.filter-dropdown-menu.show {
    display: block;
}

.filter-dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.filter-dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.filter-dropdown-item.selected {
    background-color: rgba(255, 215, 0, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

/* === RESPONSIVE FILTRES === */
@media (max-width: 1024px) {
    .filters-container {
        justify-content: flex-start;
        gap: 8px;
    }

    .filter-button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .filters-results {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
        margin-top: 12px;
    }
}

/* === ANCIENNE GRILLE DE FILTRES (conservée pour compatibilité) === */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    align-items: end;
}

.filters-grid .form-group {
    display: flex;
    flex-direction: column;
}

.filters-grid .form-group label {
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.filters-grid select,
.filters-grid .date-range-selector,
.filters-grid .btn {
    height: 44px;
}

/* Button row spans 2 columns each, centered */
.filters-grid .form-group:nth-last-child(-n+2) {
    grid-column: span 2;
}

.filters-grid .form-group:nth-last-child(2) {
    grid-column: 2 / span 2;
}

/* Date Range Selector Button */
.date-range-selector {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-range-selector:hover {
    background: rgba(252, 209, 22, 0.1);
    border-color: var(--primary-color);
}

.date-range-selector .calendar-icon {
    font-size: 18px;
}

/* Flatpickr Custom Styles */
.flatpickr-calendar {
    background: var(--card-bg) !important;
    border: 2px solid var(--border-color) !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: 'Montserrat', sans-serif !important;
}

.flatpickr-months {
    background: var(--card-bg) !important;
}

.flatpickr-current-month {
    color: var(--text-primary) !important;
}

.flatpickr-weekday {
    color: var(--text-secondary) !important;
}

.flatpickr-day {
    color: var(--text-primary) !important;
}

.flatpickr-day:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--bg-color) !important;
}

.flatpickr-day.selected {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--bg-color) !important;
}

.flatpickr-day.today {
    border-color: var(--primary-color) !important;
}

/* Date Range Modal */
.date-range-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.date-range-modal-content {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 750px;
    box-shadow: var(--shadow-lg);
}

.date-range-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.date-range-modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
}

.date-range-modal-body {
    display: flex;
    padding: 0;
    min-height: 400px;
}

.date-range-presets {
    width: 200px;
    padding: 16px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preset-btn {
    background: transparent;
    color: var(--text-primary);
    border: none;
    padding: 10px 12px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: rgba(252, 209, 22, 0.1);
}

.preset-btn.active {
    background: var(--primary-color);
    color: var(--bg-color);
    font-weight: 600;
}

.date-range-calendars {
    flex: 1;
    padding: 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.calendar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calendar-section label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.date-range-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* Flatpickr in modal adjustments */
.flatpickr-calendar.inline {
    position: relative !important;
    box-shadow: none !important;
}

.flatpickr-months .flatpickr-month {
    background: var(--card-bg) !important;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    fill: var(--primary-color) !important;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    fill: var(--text-primary) !important;
}

/* Sunburst View Toggle */
.sunburst-view-toggle {
    display: inline-flex;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
}

.view-toggle-btn {
    padding: 10px 20px;
    background: var(--card-bg);
    color: var(--text-primary);
    border: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-right: 1px solid var(--primary-color);
}

.view-toggle-btn:last-child {
    border-right: none;
}

.view-toggle-btn:hover {
    background: rgba(252, 209, 22, 0.1);
}

.view-toggle-btn.active {
    background: var(--primary-color);
    color: var(--bg-dark);
    font-weight: 600;
}

.sunburst-container {
    position: relative;
    min-height: 400px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#sunburstContainer2 {
    min-height: 800px;
    height: 800px;
}

.sunburst-breadcrumb {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background: rgba(26, 26, 31, 0.95);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid rgba(252, 209, 22, 0.2);
    max-width: calc(100% - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breadcrumb-home {
    color: var(--primary-color);
    font-weight: 500;
}

.breadcrumb-separator {
    margin: 0 8px;
    color: rgba(252, 209, 22, 0.4);
    font-weight: 300;
}

.breadcrumb-item {
    color: var(--text-primary);
}

.breadcrumb-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.breadcrumb-clickable:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

#sunburstChart {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sunburst SVG — cap at 520px; block grows to match SVG height */
#sunburstChart .msb-sunburst-svg {
    max-width: 520px;
    width: 100%;
}

/* =============================================
   Grid / Block layout — shared with beta page
   ============================================= */

.msb-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.msb-block {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.msb-block:hover {
    border-color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.msb-block-large  { grid-column: span 2; }
.msb-block-medium { grid-column: span 1; }

.msb-block-header {
    padding: 20px 24px;
    border-bottom: 1px solid #222;
    background: linear-gradient(135deg, #151515 0%, #111 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.msb-block-title {
    font-size: 16px;
    font-weight: 600;
    color: #FFD700;
    margin: 0;
}

.msb-block-content {
    padding: 24px;
}

/* Sunburst row inside block — exact copy of beta page CSS */
.msb-sunburst-row {
    display: flex;
    gap: 36px;
    align-items: center;
}

.msb-sunburst-viz {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 540px;
}

/* Sunburst containers — override legacy .sunburst-container fixed height/overflow */
#sunburstContainer,
#sunburstChart {
    width: 100%;
    max-width: 100%;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Legend panel inside sunburst block */
.msb-legend-panel {
    width: 240px;
    flex-shrink: 0;
    background: #1a1a1a;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 20px;
}

.msb-legend-title {
    font-size: 14px;
    font-weight: 600;
    color: #FFD700;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.msb-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #1e1e1e;
}

.msb-legend-item:last-child { border-bottom: none; }

.msb-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.msb-legend-label {
    flex: 1;
    font-size: 12px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msb-legend-value {
    font-size: 12px;
    font-weight: 600;
    color: #FFD700;
}

/* Performance table inside block */
.msb-perf-table-wrap {
    max-height: 420px;
    overflow-y: auto;
}

.msb-perf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

.msb-perf-table th {
    text-align: left;
    color: #666;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    padding: 0 12px 12px 12px;
    border-bottom: 1px solid #222;
    white-space: normal;
    line-height: 1.3;
    vertical-align: bottom;
}

/* Définir les largeurs des colonnes */
.msb-perf-table th:nth-child(1),
.msb-perf-table td:nth-child(1) {
    width: 30%;
}

.msb-perf-table th:nth-child(2),
.msb-perf-table td:nth-child(2) {
    width: 15%;
}

.msb-perf-table th:nth-child(3),
.msb-perf-table td:nth-child(3) {
    width: 22%;
}

.msb-perf-table th:nth-child(4),
.msb-perf-table td:nth-child(4) {
    width: 18%;
}

.msb-perf-table th:nth-child(5),
.msb-perf-table td:nth-child(5) {
    width: 15%;
}

.msb-perf-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #1a1a1a;
    color: #ccc;
    font-size: 13px;
}

.msb-perf-table tbody tr:hover td {
    background: rgba(255, 215, 0, 0.03);
}

/* Lignes de détails (déroulées) */
.msb-perf-table tbody tr.category-details-row {
    background: rgba(0, 0, 0, 0.3);
}

.msb-perf-table tbody tr.category-details-row td:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 0;
}

.msb-perf-table tbody tr.category-details-row:hover td {
    background: rgba(255, 215, 0, 0.05);
}

/* View-toggle buttons (Par URL / Par Catégorie) */
.sunburst-view-toggle {
    display: flex;
    gap: 6px;
}

.view-toggle-btn {
    background: #222;
    border: 1px solid #333;
    color: #888;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Montserrat', sans-serif;
}

.view-toggle-btn:hover {
    background: #2a2a2a;
    color: #fff;
    border-color: #FFD700;
}

.view-toggle-btn.active {
    background: #FFD700;
    color: #000;
    border-color: #FFD700;
    font-weight: 600;
}

/* =====================================================
   MSB — KPI Cards
   ===================================================== */
.msb-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.msb-kpi-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #151515 100%);
    padding: 24px 20px;
    border-radius: 14px;
    border: 1px solid #222;
    transition: all 0.3s;
}

.msb-kpi-card:hover {
    border-color: #FFD700;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.1);
}

.msb-kpi-label {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.msb-kpi-value {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =====================================================
   MSB — Section + Filter Bar
   ===================================================== */
.msb-section {
    background: linear-gradient(135deg, #1a1a1a 0%, #151515 100%);
    padding: 24px 28px;
    border-radius: 14px;
    border: 1px solid #222;
    margin-bottom: 20px;
}

.msb-filters-section {
    padding: 16px 20px;
    margin-bottom: 20px;
}

.msb-filter-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.msb-filter-btn {
    background: #222;
    border: 1px solid #333;
    padding: 8px 16px;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.msb-filter-btn:hover {
    background: #2a2a2a;
    border-color: #FFD700;
}

.msb-filter-btn.active {
    background: #FFD700;
    color: #000;
    border-color: #FFD700;
    font-weight: 600;
}

.msb-filter-select {
    background: #222;
    border: 1px solid #333;
    color: #fff;
    padding: 8px 32px 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s;
}

.msb-filter-select:hover,
.msb-filter-select:focus {
    border-color: #FFD700;
    outline: none;
}

.msb-filter-select option {
    background: #1a1a1a;
}

.msb-reset-btn {
    background: #FFD700;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    color: #000;
    font-weight: 600;
    font-size: 13px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.msb-reset-btn:hover {
    background: #FFA500;
    transform: scale(1.03);
}

/* =====================================================
   MSB — Category Grid (inside #cartographieSection)
   ===================================================== */
.msb-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.msb-category-card {
    background: #0f0f0f;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    transition: all 0.25s;
    cursor: pointer;
}

.msb-category-card:hover {
    border-color: #FFD700;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(255, 215, 0, 0.1);
}

.msb-category-card-name {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msb-category-card-value {
    font-size: 20px;
    font-weight: 700;
    color: #FFD700;
}

/* =====================================================
   MSB — Stacked Bar (Répartition des Pages)
   ===================================================== */
.msb-stacked-bar {
    width: 100%;
    height: 46px;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    margin-bottom: 16px;
}

.msb-stack-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    transition: filter 0.2s;
    cursor: pointer;
    border-right: 2px solid #0a0a0a;
    white-space: nowrap;
    overflow: hidden;
    padding: 0 4px;
}

.msb-stack-segment:last-child { border-right: none; }
.msb-stack-segment:hover { filter: brightness(1.3); }

/* Legend row shared by stacked bar */
.msb-legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 10px;
}

.msb-legend-row-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.msb-legend-row-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.msb-legend-row-text { color: #ccc; }
.msb-legend-row-val { color: #FFD700; font-weight: 600; }

/* =====================================================
   MSB — Horizontal Bar Chart (Répartition des Vues)
   ===================================================== */
.msb-bar-chart {
    width: 100%;
}

.msb-bar-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.msb-bar-label {
    width: 130px;
    font-size: 12px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.msb-bar-track {
    flex: 1;
    height: 26px;
    background: #1a1a1a;
    border-radius: 6px;
    overflow: hidden;
}

.msb-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s cubic-bezier(.22,.61,0,1);
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    width: 0%;
}

.msb-bar-num {
    width: 65px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: #FFD700;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1100px) {
    .msb-grid-layout {
        grid-template-columns: 1fr;
    }
    .msb-block-large,
    .msb-block-medium {
        grid-column: span 1;
    }
    .msb-sunburst-row {
        flex-direction: column;
        align-items: center;
    }
    .msb-legend-panel {
        width: 100%;
        max-width: 400px;
    }
    .msb-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .msb-kpi-grid {
        grid-template-columns: 1fr;
    }
    .msb-filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .msb-reset-btn {
        margin-left: 0;
    }
}

/* Sunburst renderer — msb classes (exact copy from mes-scores-bis.css) */
.msb-arc-segment {
    transition: none;
}

.msb-sunburst-svg {
    transition: none;
    display: block;
    margin: 0 auto;
}

.msb-center-text {
    text-anchor: middle;
    fill: #fff;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
}

.msb-center-label {
    font-size: 12px;
    fill: #888;
    letter-spacing: 2px;
}

.msb-center-value {
    font-size: 24px;
    fill: #FFD700;
    font-weight: 700;
}

/* Breadcrumb — msb classes (also used by beta page) */
.sunburst-breadcrumb-item {
    cursor: pointer;
    transition: color 0.2s;
    color: #FFD700;
    font-size: 13px;
}

.sunburst-breadcrumb-item:hover {
    color: #FFA500;
    text-decoration: underline;
}

.sunburst-breadcrumb-item.active {
    cursor: default;
    color: #fff;
    font-weight: 600;
}

.sunburst-breadcrumb-item.active:hover {
    text-decoration: none;
}

.sunburst-breadcrumb-separator {
    color: #aaa;
    user-select: none;
    font-size: 13px;
    font-weight: 300;
}

.sunburst-tooltip {
    position: fixed;
    background: rgba(10, 10, 10, 0.95);
    border: 2px solid #FFD700;
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    z-index: 1000;
    max-width: 300px;
    min-width: 200px;
    backdrop-filter: blur(8px);
}

/* msb-tooltip HTML structure (used by sunburst.js / mes-scores-bis renderer) */
.msb-tooltip-title {
    font-size: 15px;
    font-weight: 600;
    color: #FFD700;
    margin-bottom: 8px;
}

.msb-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
    margin: 4px 0;
}

.msb-tooltip-label { color: #888; }
.msb-tooltip-val   { color: #fff; font-weight: 600; }

/* Legacy tooltip classes (kept for backward compat) */
.tooltip-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #FFD700;
    font-size: 15px;
}

.tooltip-content div {
    font-size: 13px;
    margin-bottom: 4px;
    color: #ccc;
}

.tooltip-path {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.loading-message,
.empty-message {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading-spinner {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

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

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: rgba(252, 209, 22, 0.1);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.data-table td {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Force white color for URLs in category details modal */
#categoryPagesTableBody td {
    color: var(--text-secondary) !important;
}

#categoryPagesTableBody td a {
    color: var(--text-secondary) !important;
    text-decoration: none !important;
}

/* Limit URL column width and truncate long URLs */
#categoryPagesTableBody td:first-child {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    background-color: rgba(252, 209, 22, 0.2);
}

.url-cell {
    max-width: 600px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Align numeric columns to the right in pages table */
#pagesTable th:not(:first-child),
#pagesTable td:not(:first-child) {
    text-align: right;
}

/* Keep URL column aligned to left */
#pagesTable th:first-child,
#pagesTable td:first-child {
    text-align: left;
}

/* Align numeric columns to the right in category pages modal table */
#categoryPagesTable th:not(:first-child),
#categoryPagesTable td:not(:first-child) {
    text-align: right;
}

/* Keep URL column aligned to left */
#categoryPagesTable th:first-child,
#categoryPagesTable td:first-child {
    text-align: left;
}

/* Column widths for category pages modal table */
#categoryPagesTable {
    table-layout: fixed;
    width: 100%;
}

#categoryPagesTable th:nth-child(1),
#categoryPagesTable td:nth-child(1) {
    width: 70%;
}

#categoryPagesTable th:nth-child(2),
#categoryPagesTable td:nth-child(2) {
    width: 15%;
}

#categoryPagesTable th:nth-child(3),
#categoryPagesTable td:nth-child(3) {
    width: 15%;
}

.table-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.table-container {
    overflow-x: auto;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.pagination-controls span {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid #222 !important;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 2001;
}

/* Scrollbar styling for modals */
.modal-content {
    scrollbar-width: thin;
    scrollbar-color: #666 #1a1a1a;
}

.modal-content::-webkit-scrollbar {
    width: 12px;
}

.modal-content::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 6px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 6px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.code-block {
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0;
    position: relative;
}

.code-block pre {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    overflow-x: auto;
    margin-bottom: 12px;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Category Performance Table - Expandable Rows */
.btn-expand {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-expand:hover {
    color: var(--primary-color);
}

.btn-expand svg {
    transition: transform 0.3s ease;
}

.category-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.category-row:hover {
    background-color: rgba(255, 215, 0, 0.05);
}

.category-details-row {
    background: rgba(255, 215, 0, 0.02) !important;
    border-left: 3px solid var(--primary-color);
}

.category-details-row:hover {
    background: rgba(255, 215, 0, 0.08) !important;
}

.category-details-row td {
    border-top: 1px solid rgba(255, 215, 0, 0.1);
}

/* Fixed table layout for column alignment */
#categoryPerformanceTable {
    table-layout: fixed;
    width: 100%;
}

#categoryPerformanceTable th:nth-child(1) { width: 50%; } /* Catégorie/URL */
#categoryPerformanceTable th:nth-child(2) { width: 15%; } /* Vues Totales */
#categoryPerformanceTable th:nth-child(3) { width: 15%; } /* Pages Uniques */
#categoryPerformanceTable th:nth-child(4) { width: 15%; } /* Profondeur Moy. */
#categoryPerformanceTable th:nth-child(5) { width: 5%; } /* Bouton expand */

/* Responsive Design */

/* Tablets and small screens */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-container {
        overflow-x: auto;
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .navigation-sidebar {
        display: none;
    }

    .dashboard-main {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .site-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .site-header > div:last-child {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .site-header button {
        width: 100%;
    }

    #sunburstChart {
        height: 350px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-user {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .header-select {
        width: 100%;
        order: -1;
        margin-bottom: 12px;
    }

    /* Tables responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 20px auto;
        padding: 20px;
    }

    .modal h2 {
        font-size: 20px;
    }

    /* Forms */
    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 14px;
        padding: 10px;
    }

    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Custom dropdown */
    .custom-select-dropdown {
        max-height: 300px;
    }

    /* Category bars */
    .category-bar-fill {
        min-width: 20px;
    }

    /* Pagination */
    .pagination-controls {
        flex-direction: column;
        gap: 10px;
    }

    .pagination-controls button {
        width: 100%;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .dashboard-header h1 {
        font-size: 20px;
    }

    .stat-value {
        font-size: 24px;
    }

    .filters-grid {
        gap: 8px;
    }

    #sunburstChart {
        height: 300px;
    }

    .modal-content {
        padding: 16px;
    }

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

    /* Stack all stat cards */
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card {
    animation: fadeIn 0.3s ease-out;
}

.stat-card {
    animation: fadeIn 0.5s ease-out;
}

/* Collaborators Styles */
.collaborators-list {
    margin-top: 15px;
}

.collaborator-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    margin-bottom: 10px;
}

.collaborator-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.collaborator-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.collaborator-email {
    font-size: 13px;
    color: var(--text-secondary);
}

.collaborator-role {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge {
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--primary-color);
    color: white;
    width: fit-content;
}

.add-collaborator-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.collaborators-list-section h3 {
    margin-bottom: 10px;
}

/* Category Styles */
.category-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.category-stats-header h3 {
    margin: 0;
}

.category-stats-header .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: 40px;
    line-height: 1;
}

.category-stats-header .btn:hover {
    background: #ffe033;
    border-color: #ffe033;
    transform: translateY(-1px);
}

.category-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.category-stat-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #151515 100%);
    border: 1px solid #222;
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.category-stat-card:hover {
    border-color: #FFD700;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(255, 215, 0, 0.10);
}

.category-name {
    font-size: 11px;
    font-weight: 500;
    color: #888;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.categories-list {
    margin-top: 15px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    margin-bottom: 10px;
}

.category-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.category-rule {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: monospace;
}

.category-priority {
    font-size: 12px;
    color: var(--text-secondary);
}

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

.add-category-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--card-border);
}

.categories-list-section h3 {
    margin-bottom: 10px;
}

/* Multi-Conditions Builder */
.multi-conditions-list {
    margin: 15px 0;
    padding: 15px;
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    border-radius: 8px;
}

.condition-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: end;
    padding: 10px;
    background: var(--card-bg);
    border: 1px solid #333;
    border-radius: 6px;
    margin-bottom: 10px;
}

.condition-item .form-group {
    margin-bottom: 0;
}

.condition-item .btn-danger {
    height: 42px;
    padding: 0 15px;
}

/* ==================== THEME SYSTEM ==================== */

/* Light Theme */
body[data-theme="light"] {
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #0C090A;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .dashboard-header {
    background: #ffffff;
    border-bottom: 2px solid var(--primary-color);
}

body[data-theme="light"] .navigation-sidebar {
    background: #ffffff;
    border-right: 2px solid var(--primary-color);
}

body[data-theme="light"] .nav-item:hover {
    background: rgba(252, 209, 22, 0.1);
}

body[data-theme="light"] .nav-item.active {
    background: transparent;
}

body[data-theme="light"] h1,
body[data-theme="light"] h2,
body[data-theme="light"] h3 {
    color: var(--text-primary);
}

body[data-theme="light"] .stat-card,
body[data-theme="light"] .table-section,
body[data-theme="light"] .visualization-section,
body[data-theme="light"] .filters-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

body[data-theme="light"] .modal-content {
    background: #ffffff;
}

/* ==================== SETTINGS PAGE ==================== */

#parametresSection {
    max-width: 1400px;
}

#parametresSection h2 {
    color: var(--primary-color);
    font-size: 32px;
    margin-bottom: 30px;
}

/* Settings Grid - 2 colonnes */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.settings-column-left,
.settings-column-right {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Le bloc Code de Suivi doit avoir la hauteur des 2 premiers blocs de gauche */
.settings-card-tracking {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.settings-card-tracking .settings-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.settings-card-tracking .code-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-bottom: 0;
}

.settings-card-tracking .code-block pre {
    flex: 1;
    min-height: 200px;
}

.settings-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.settings-card:hover {
    border-color: #333;
}

.settings-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #222;
    background: linear-gradient(135deg, #151515 0%, #111 100%);
}

.settings-card-header h3 {
    color: #FFD700;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.settings-card-body {
    padding: 24px;
}

.settings-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--card-border);
}

.settings-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-item:first-child {
    padding-top: 0;
}

.settings-item-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.settings-item-value {
    color: var(--text-secondary);
    font-size: 15px;
}

.settings-item-info {
    flex: 1;
}

.settings-item-description {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    gap: 8px;
}

.theme-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.theme-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.theme-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #0C090A;
}

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

/* Danger Zone */
.danger-zone {
    border-color: var(--danger-color);
}

.danger-zone .settings-card-header {
    border-bottom-color: var(--danger-color);
}

.danger-zone .settings-card-header h3 {
    color: var(--danger-color);
}

/* Code Block in Settings */
.settings-card .code-block {
    margin-top: 0;
}

/* Responsive Settings */
@media (max-width: 768px) {
    .settings-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .theme-toggle {
        width: 100%;
    }

    .theme-btn {
        flex: 1;
        justify-content: center;
    }

    #parametresSection h2 {
        font-size: 24px;
    }
}

/* ==================== DOCUMENTATION PAGE ==================== */

#documentationSection {
    max-width: 900px;
    line-height: 1.8;
}

#documentationSection h2 {
    color: var(--primary-color);
    font-size: 32px;
    margin-bottom: 30px;
}

#documentationSection h3 {
    color: var(--primary-color);
    font-size: 24px;
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
}

#documentationSection h4 {
    color: var(--text-primary);
    font-size: 18px;
    margin-top: 24px;
    margin-bottom: 12px;
}

#documentationSection h5 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Table of Contents */
.doc-toc {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 40px;
}

.doc-toc h3 {
    margin-top: 0;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
}

.doc-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-toc li {
    margin-bottom: 10px;
}

.doc-toc a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

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

/* Documentation Sections */
.doc-section {
    margin-bottom: 50px;
}

.doc-intro {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.doc-subsection {
    margin-bottom: 30px;
}

/* Steps */
.doc-steps {
    margin-top: 20px;
}

.doc-step {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
}

.step-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: #0C090A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.step-content {
    flex: 1;
}

.step-content h5 {
    margin-top: 0;
}

.step-content p {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.step-content p:last-child {
    margin-bottom: 0;
}

/* Code Examples */
.code-example {
    margin: 16px 0;
}

.code-example pre {
    background: #1a1a1a;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.code-example .highlight {
    background: rgba(252, 209, 22, 0.1);
    border-left: 3px solid var(--primary-color);
    padding-left: 8px;
    display: block;
}

.code-example code {
    background: rgba(252, 209, 22, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* Lists */
.doc-list {
    margin: 16px 0;
    padding-left: 24px;
}

.doc-list li {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.doc-list strong {
    color: var(--text-primary);
}

/* Notes and Alerts */
.doc-note {
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid;
}

.doc-note.info {
    background: rgba(135, 220, 213, 0.1);
    border-left-color: var(--secondary-color);
}

.doc-note.warning {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--danger-color);
}

.doc-note strong {
    color: var(--text-primary);
}

/* Example Boxes */
.doc-example {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.doc-example strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 8px;
}

.doc-example ul {
    margin: 8px 0 0 0;
    padding-left: 24px;
}

/* Role Cards */
.role-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.role-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.role-card h5 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 16px;
}

.role-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.role-card li {
    padding: 6px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.role-card li:before {
    content: "✓ ";
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 8px;
}

/* FAQ Items */
.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.faq-item h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 16px;
}

.faq-item p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Light Theme Overrides for Documentation */
body[data-theme="light"] .code-example pre {
    background: #f5f5f5;
    color: #333;
    border-color: var(--border-color);
}

/* Responsive Documentation */
@media (max-width: 768px) {
    #documentationSection h2 {
        font-size: 24px;
    }

    #documentationSection h3 {
        font-size: 20px;
    }

    .doc-step {
        flex-direction: column;
        gap: 12px;
    }

    .role-cards {
        grid-template-columns: 1fr;
    }

    .code-example pre {
        font-size: 12px;
        padding: 12px;
    }
}

/* ==================== CARTOGRAPHY SELECTOR ==================== */

.cartography-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #151515 0%, #111 100%);
    border: 1px solid #222;
    border-radius: 12px;
    min-height: 80px;
    font-family: 'Montserrat', sans-serif;
}

.cartography-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cartography-selector-wrapper label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    line-height: 1;
    display: flex;
    align-items: center;
}

.cartography-select {
    display: flex;
    align-items: center;
    margin-bottom: 0 !important;
}

.cartography-select .custom-select-button {
    min-width: 300px;
    height: 40px;
    padding: 8px 12px;
    line-height: 1;
}

.cartography-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cartography-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: 40px;
    line-height: 1;
}

.cartography-actions .btn svg {
    flex-shrink: 0;
    vertical-align: middle;
}

.cartography-actions .btn:hover {
    background: #ffe033;
    border-color: #ffe033;
    transform: translateY(-1px);
}

/* Responsive Cartography Header */
@media (max-width: 768px) {
    .cartography-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .cartography-selector-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .cartography-select .custom-select-button {
        min-width: 100%;
    }

    #createCartographyBtn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Color Picker Custom Styling
   ============================================ */
.color-picker-wrapper {
    position: relative;
    width: 100%;
}

.color-picker-button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-color);
}

.color-picker-button:hover {
    border-color: var(--primary-color);
    background: var(--hover-bg);
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.color-value {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-picker-button svg {
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.color-picker-button:hover svg {
    opacity: 1;
}

.hidden-color-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}
