:root {
    --bg: #12171f;
    --panel: #1c2431;
    --text: #e4e9f2;
    --accent: #5ca4ff;
    --muted: #8a98ae;
    --border: rgba(92, 164, 255, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, system-ui, sans-serif;
    background: radial-gradient(circle at top, #1b2a44, #0d121b 55%);
    color: var(--text);
}

.window {
    width: min(1200px, calc(100vw - 32px));
    margin: 20px auto;
    background: linear-gradient(180deg, rgba(12, 17, 30, 0.96), rgba(14, 19, 33, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
    border-radius: 24px;
}

/* Nouvel agencement du Dashboard avec Barre Latérale */
.dashboard-layout {
    display: flex;
    padding: 0;
    overflow: hidden;
    height: 85vh; /* Fixe la hauteur pour permettre le scroll du contenu */
}

.sidebar {
    width: 240px;
    background: rgba(20, 26, 38, 0.6);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 30px 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--accent);
    letter-spacing: 2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-grow: 1;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--muted);
    padding: 16px 24px;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.tab-btn:hover {
    background: rgba(92, 164, 255, 0.05);
    color: var(--text);
}

.tab-btn.active {
    background: rgba(92, 164, 255, 0.1);
    color: var(--accent);
    border-left-color: var(--accent);
}

.main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
}

.tab-pane {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

header {
    margin-bottom: 24px;
}

header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 2.4vw, 2.8rem);
}

header p {
    color: var(--muted);
    margin: 8px 0 0;
}

.panel {
    background: var(--panel);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
}

.panel h2 {
    margin: 0 0 16px;
    font-size: 1.2rem;
}

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid div,
.grid-summary div {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.grid div strong,
.grid-summary div strong {
    color: var(--muted);
    font-size: 0.9rem;
}

.grid div span,
.grid-summary div span {
    font-size: 1.05rem;
    color: var(--text);
}

.grid-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--muted);
    font-size: 0.95rem;
}

tbody tr:hover {
    background: rgba(92, 164, 255, 0.08);
}

tbody td {
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   AUTHENTICATION STYLING (COSMIC / SCI-FI GLASSMORPHISM)
   ========================================================================== */

/* Utility to hide elements */
.hidden {
    display: none !important;
}

/* Header Layout & Profile Badge */
.header-layout {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

@media (max-width: 600px) {
    .header-layout {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

.profile-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 18px;
    background: rgba(92, 164, 255, 0.08);
    border: 1px solid rgba(92, 164, 255, 0.2);
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.profile-status-glow {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff88;
    box-shadow: 0 0 10px #00ff88;
}

#badge-username {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.5px;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.12);
    transform: scale(1.1);
}

/* Immersive Login Screen styling */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #142137 0%, #06090f 100%);
    overflow: hidden;
    z-index: 1000;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Starfield and nebula ambient effects */
.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 1.5px, transparent 30px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 20px),
        radial-gradient(white, rgba(255,255,255,.1) 1.5px, transparent 30px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    opacity: 0.25;
}

.nebula {
    position: absolute;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle at 75% 25%, rgba(92, 164, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 25% 75%, rgba(255, 110, 40, 0.04) 0%, transparent 45%);
    animation: nebulaMove 30s ease-in-out infinite alternate;
}

@keyframes nebulaMove {
    0% { transform: translate(-10%, -10%) rotate(0deg); }
    100% { transform: translate(10%, 10%) rotate(6deg); }
}

.login-card {
    position: relative;
    width: min(440px, 90%);
    padding: 40px;
    background: rgba(28, 36, 49, 0.65);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(92, 164, 255, 0.22);
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 50px rgba(92, 164, 255, 0.08);
    text-align: center;
    z-index: 10;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo-container {
    margin-bottom: 24px;
    position: relative;
}

.logo-text {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 6px;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 40px;
    background: var(--accent);
    filter: blur(35px);
    opacity: 0.3;
    z-index: -1;
}

.login-card h2 {
    font-size: 1.25rem;
    color: var(--text);
    margin: 0 0 8px 0;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0 0 28px 0;
    line-height: 1.4;
}

.input-group {
    text-align: left;
    margin-bottom: 22px;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(92, 164, 255, 0.05);
    box-shadow: 0 0 15px rgba(92, 164, 255, 0.15);
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #3d8bff 0%, #1e6eff 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(30, 110, 255, 0.25);
    margin-top: 10px;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(30, 110, 255, 0.35), 0 0 15px rgba(92, 164, 255, 0.25);
    background: linear-gradient(135deg, #4d95ff 0%, #2e7eff 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    color: var(--muted);
    cursor: not-allowed;
    transform: none;
}

.error-msg {
    margin-top: 20px;
    padding: 12px 16px;
    background: rgba(255, 92, 92, 0.08);
    border: 1px solid rgba(255, 92, 92, 0.25);
    border-radius: 10px;
    color: #ff7676;
    font-size: 0.85rem;
    line-height: 1.45;
    text-align: left;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* Styles pour la Hiérarchie */
.hierarchy-level {
    margin-bottom: 24px;
}

.hierarchy-level h2 {
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.hierarchy-branches {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hierarchy-branch {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.hierarchy-branch h3 {
    margin: 0 0 16px 0;
    color: var(--accent);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.roles-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.role-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.role-item strong {
    display: block;
    color: #fff;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.role-item p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
}

