/* Markellia - Portail des rapports TER
   Design aligné sur www.markellia.com
   Palette : Navy #0e1b5a, Dark Navy #020834, Crème #F5F0E8, Blanc */

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

body {
    font-family: 'Avenir Next', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: #F5F0E8;
    color: #1a1a2e;
    line-height: 1.6;
}

/* ===== Page Login ===== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0e1b5a 0%, #020834 100%);
}

.login-card {
    background: white;
    border-radius: 8px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.login-logo {
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: #6B7280;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.4rem;
}

.form-group input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #0e1b5a;
    box-shadow: 0 0 0 3px rgba(14, 27, 90, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background: #0e1b5a;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.btn-primary:hover {
    background: #020834;
}

/* ===== Flash messages ===== */

.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.flash-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* ===== Layout principal ===== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */

.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-logo {
    text-align: center;
    padding: 2rem 1.5rem 0.5rem;
}

.sidebar-subtitle {
    text-align: center;
    font-size: 0.75rem;
    color: #6B7280;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
}

.sidebar-nav {
    padding: 1rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s;
}

.nav-item:hover {
    background: #F5F0E8;
}

.nav-item.active {
    background: #0e1b5a;
    color: white;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-name {
    font-size: 0.85rem;
    color: #374151;
    font-weight: 500;
}

.logout-link {
    font-size: 0.8rem;
    color: #6B7280;
    text-decoration: none;
}

.logout-link:hover {
    color: #DC2626;
}

/* ===== Contenu principal ===== */

.main-content {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
}

.content-header {
    margin-bottom: 2rem;
}

.content-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0e1b5a;
    margin-bottom: 0.3rem;
}

.header-subtitle {
    color: #6B7280;
    font-size: 0.9rem;
}

/* ===== État vide ===== */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #9CA3AF;
}

.empty-state p {
    margin-top: 1rem;
    font-size: 0.95rem;
}

/* ===== Arborescence ===== */

.tree-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

details summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: '▶';
    display: inline-block;
    font-size: 0.65rem;
    margin-right: 0.5rem;
    transition: transform 0.15s;
    color: #9CA3AF;
}

details[open] > summary::before {
    transform: rotate(90deg);
}

/* Region */

.tree-region {
    background: white;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    overflow: hidden;
}

.tree-region-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 1rem;
    color: #0e1b5a;
    background: white;
}

.tree-region-title:hover {
    background: #FAFAFA;
}

/* Année */

.tree-year {
    margin-left: 1.25rem;
    border-top: 1px solid #F3F4F6;
}

.tree-year-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: #374151;
}

.tree-year-title:hover {
    background: #FAFAFA;
}

/* Mois */

.tree-month {
    margin-left: 1.25rem;
    border-top: 1px solid #F3F4F6;
}

.tree-month-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
    color: #4B5563;
}

.tree-month-title:hover {
    background: #FAFAFA;
}

.file-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: #9CA3AF;
    font-weight: 400;
}

/* Fichiers */

.file-list {
    list-style: none;
    margin-left: 1.5rem;
    padding-bottom: 0.5rem;
}

.file-item {
    border-top: 1px solid #F3F4F6;
}

.file-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: #1a1a2e;
    transition: background 0.15s;
    border-radius: 4px;
}

.file-link:hover {
    background: #F5F0E8;
}

.file-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.file-meta {
    margin-left: auto;
    font-size: 0.75rem;
    color: #9CA3AF;
    white-space: nowrap;
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #E5E7EB;
    }
    .sidebar-nav {
        display: flex;
        padding: 0.5rem 1rem;
    }
    .main-content {
        padding: 1.5rem;
    }
}
