/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #1A2B3C;
    background-color: #f5f7fa;
}

/* Colors Palette */
:root {
    --primary: #4DC94B;
    --primary-dark: #38A83C;
    --primary-rgb: 77, 201, 75;
    --secondary: #243B55;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --info: #3498db;
    --light: #f5f7fa;
    --dark: #1A2B3C;
    --text: #1A2B3C;
    --text-muted: #5a6a7a;
    --text-light: #8a9bac;
    --border: #e8edf2;
    --shadow-sm: 0 2px 4px rgba(26, 43, 60, 0.06);
    --shadow-md: 0 2px 8px rgba(26, 43, 60, 0.09);
    --shadow-lg: 0 10px 40px rgba(26, 43, 60, 0.18);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 32px;
}

h2 {
    font-size: 24px;
}

h3 {
    font-size: 18px;
}

p {
    margin-bottom: 1rem;
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(var(--primary-rgb), 0.35);
}

.btn-secondary {
    background-color: #edf1f5;
    color: var(--text-muted);
}

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

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

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

/* Forms */
input, textarea, select {
    font-family: inherit;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(77, 201, 75, 0.15);
}

/* Containers */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.card-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.card-header h2 {
    margin: 0;
}

.card-body {
    padding: 0;
}

.card-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 16px;
}

/* Navbar */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.navbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    font-weight: 600;
    color: var(--dark);
    pointer-events: none;
}

.brand-name {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--dark);
}

.brand-name .brand-accent {
    color: var(--primary-dark);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.user-info {
    font-size: 14px;
    color: var(--text-muted);
}

.user-email {
    font-weight: 500;
    color: var(--dark);
}

.logout-btn {
    padding: 8px 16px;
    background-color: #edf1f5;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}

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

/* Subnav */
.subnav {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    justify-content: center;
}

.subnav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.subnav-link:hover {
    color: var(--dark);
    border-bottom-color: var(--primary);
}

.subnav-link.active {
    color: var(--dark);
    border-bottom-color: var(--primary);
}

/* Onglet désactivé pour le domaine : visible mais grisé et inerte */
.subnav-link.disabled,
.subnav-link.disabled:hover {
    opacity: 0.4;
    cursor: not-allowed;
    color: var(--text-muted);
    border-bottom-color: transparent;
}

/* Subnav — icônes monochromes des liens */
.subnav-home-icon,
.subnav-ico { display: block; flex-shrink: 0; }

/* Subnav dropdown */
.subnav-dropdown {
    position: relative;
    display: flex;
    align-items: stretch;
}

.subnav-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

.subnav-caret {
    font-size: 10px;
    transition: transform 0.2s;
}

.subnav-dropdown:hover .subnav-caret {
    transform: translateY(1px);
}

.subnav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
    z-index: 1000;
}

.subnav-dropdown:hover .subnav-dropdown-menu,
.subnav-dropdown:focus-within .subnav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.subnav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.15s, color 0.15s;
}

/* Icône SVG monochrome d'un item de menu : hérite de la couleur du lien
   (normal / survol / actif / grisé) via stroke="currentColor". */
.subnav-dropdown-icon {
    display: block;
    width: 20px;
    height: 18px;
    flex-shrink: 0;
}

.subnav-dropdown-item:hover {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--dark);
}

.subnav-dropdown-item.active {
    color: var(--primary-dark);
    background-color: rgba(var(--primary-rgb), 0.12);
}

.subnav-dropdown-item.disabled,
.subnav-dropdown-item.disabled:hover {
    opacity: 0.4;
    cursor: not-allowed;
    color: var(--text-muted);
    background-color: transparent;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

thead {
    background-color: var(--light);
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background-color: #f8fafb;
}

/* Utilities */
.text-center {
    text-align: center;
}

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

.text-light {
    color: var(--text-light);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-flex {
    display: flex;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

.hidden {
    display: none !important;
}

/* Responsive */

/* La marque centrale est posée en absolu, au milieu de la barre : sous une
   certaine largeur elle passe SOUS le bloc « Connecté en tant que… », qui la
   recouvre. Elle est purement décorative (l'identité de l'app est déjà dans le
   titre de l'onglet) : on la retire plutôt que de la laisser se chevaucher. */
@media (max-width: 1100px) {
    .navbar-center { display: none; }
}

@media (max-width: 768px) {
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    h3 {
        font-size: 16px;
    }

    .container {
        padding: 0 16px;
    }

    .card {
        padding: 16px;
    }
}

/* Tableaux de liste : sous 900 px, les colonnes de contexte (auteur, dates)
   feraient déborder la page horizontalement. On les retire — l'essentiel est
   l'intitulé et le menu d'actions, et le détail reste consultable en ouvrant
   l'élément. Masquer plutôt que faire défiler : la carte doit garder
   `overflow: visible`, sans quoi le menu « Actions » serait tronqué. */
@media (max-width: 900px) {
    .table-card th.col-secondary,
    .table-card td.col-secondary { display: none; }
}
