/* public/assets/css/style.css */

/* ==========================================================================
   1. VARIABLES & THÈME (:root)
   ========================================================================== */
:root {
    /* -- Fond & Thème -- */
    --bg-gradient-start: #16222A;
    --bg-gradient-end: #3A6073;
    
    /* -- Texte -- */
    --text-color: #e0e0e0;
    --text-white: #fff;
    --text-muted: #d1d1d1;
    
    /* -- Composants (Verre) -- */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    
    /* -- Accents & Actions -- */
    --primary-accent: #8e44ad;      /* Violet */
    --primary-accent-hover: #9b59b6;
    
    /* -- Statuts & Admin -- */
    --success-color: #b9f6ca;
    --danger-color: #c0392b;
    --danger-hover: #e74c3c;
    --info-color: #3498db;
    --warning-color: #f1c40f;
    
    /* -- Layout -- */
    --sidebar-width: 250px;
}

/* ==========================================================================
   2. BASE & RESET
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* Attention: peut bloquer le scroll sur mobile */
}

.container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

/* ==========================================================================
   3. COMPOSANTS UI (Cards, Inputs, Boutons)
   ========================================================================== */

/* --- Glass Card --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    padding: 30px 35px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    text-align: center;
}

.glass-card h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-white);
    text-shadow: 0 0 10px rgba(0,0,0,0.2);
}

/* --- Formulaires --- */
input[type="text"],
input[type="password"],
input[type="email"] {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 15px;
    font-size: 1rem;
    color: var(--text-white);
    width: 100%;
    margin-bottom: 1rem;
    transition: background 0.3s;
}

input::placeholder { color: var(--text-muted); }

input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* --- Boutons --- */
button, button[type="submit"], a.button-like {
    background: var(--primary-accent);
    color: white;
    border: none;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 1rem;
    margin-bottom: 2rem; /* Préservé de votre css original */
    width: 100%;
    transition: background-color 0.3s;
    text-align: center;
    display: inline-block; /* Pour les liens */
}

button:hover, button[type="submit"]:hover, a.button-like:hover {
    background: var(--primary-accent-hover);
}

/* Variantes Boutons */
button.danger, a.button-like.danger { background-color: var(--danger-color); }
button.danger:hover, a.button-like.danger:hover { background-color: var(--danger-hover); }

button.secondary {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
}

/* --- Liens & Messages --- */
.links {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
}

.links a {
    color: #f0f0f0;
    text-decoration: none;
    font-size: 0.9rem;
}
.links a:hover { text-decoration: underline; }

.cancel-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--text-color);
    text-align: center;
    width: 100%;
}

.message-area {
    min-height: 24px;
    margin-bottom: 1rem;
    font-weight: 600;
    text-align: center;
    color: var(--success-color);
}

/* ==========================================================================
   4. LAYOUT PORTAIL (Sidebar + Content)
   ========================================================================== */

.portal-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    padding: 20px;
    gap: 20px;
    /* Écrase le centrage du body pour le layout complet */
    justify-content: flex-start; 
    align-items: stretch;
}

/* --- Navigation Sidebar --- */
.portal-nav, .sidebar {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    padding: 25px 20px 0px 20px;
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.portal-nav h2, .nav-header h2, .sidebar-header h3 {
    text-align: center;
    color: var(--text-white);
    margin-bottom: 2rem;
}

.portal-nav ul, .nav-links, .nav-links-main {
    list-style: none;
    padding: 0; margin: 0;
}

.nav-links-main {
    flex: 1; /* Pousse le footer vers le bas */
    display: flex; flex-direction: column; gap: 10px;
}

.portal-nav li a, .nav-link {
    display: block;
    color: var(--text-color);
    text-decoration: none;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: background 0.3s;
    display: flex; align-items: center; gap: 10px; /* Alignement icônes */
}

.portal-nav li a:hover, .portal-nav li a.active, .nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
}

/* Footer Sidebar */
.nav-footer, .sidebar-footer {
    margin-top: auto;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

.logout-link {
    color: #e74c3c !important;
    opacity: 0.8;
    margin: 10px 0 20px 0;
    padding: 12px 20px;
}
.logout-link:hover {
    opacity: 1;
    background: rgba(231, 76, 60, 0.1);
}

/* --- Contenu Principal --- */
.portal-content, .main-content {
    flex-grow: 1;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 40px;
    overflow-y: auto;
}

/* Scrollbar cachée */
.portal-content::-webkit-scrollbar { display: none; }
.portal-content { -ms-overflow-style: none; scrollbar-width: none; }

/* ==========================================================================
   5. MODULES (Apps, Admin)
   ========================================================================== */

/* --- Grille Apps --- */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.app-card {
    background: rgba(45, 52, 64, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: var(--text-color);
    text-align: center;
    margin-top: 1.5rem;
    display: flex; flex-direction: column; height: 100%;
}

.app-card:hover {
    transform: translateY(-8px);
    background: rgba(55, 62, 74, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.app-card .card-body {
    padding: 1.5rem;
    display: flex; flex-direction: column; height: 100%;
}

.app-card .card-title {
    font-size: 1.2rem; font-weight: 600; margin-top: 1rem; color: #FFFFFF;
}
.app-card .card-text {
    font-size: 0.9rem; color: #BDBDBD; flex-grow: 1; margin-bottom: 1.5rem;
}

.app-card .fa-3x {
    color: #c5a6ff; opacity: 0.9; transition: all 0.3s ease;
}
.app-card:hover .fa-3x { transform: scale(1.1); opacity: 1; }

/* Bouton Lancer (Style Pilule) */
.app-card .btn.btn-primary {
    background: transparent;
    border: 1px solid #c5a6ff;
    border-radius: 20px;
    padding: 0.5rem 1.5rem;
    color: #c5a6ff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: all 0.3s ease;
    margin-top: auto;
    text-decoration: none;
    display: inline-block;
    width: auto; /* Override du width 100% des boutons globaux */
}

.app-card .btn.btn-primary:hover {
    background-color: #c5a6ff;
    color: #1a1d24;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(197, 166, 255, 0.3);
}

/* --- Admin Actions --- */
.action-buttons-container {
    display: flex; justify-content: center; gap: 8px; align-items: center;
}

.btn-icon {
    width: 32px; height: 32px; border-radius: 6px; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1); color: var(--text-color);
    font-size: 0.9rem; padding: 0; margin: 0; /* Reset marges boutons globaux */
}
.btn-icon:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.2); }

.btn-icon.info { background: rgba(52, 152, 219, 0.8); color: rgba(255, 255, 255, 0.8); }
.btn-icon.info:hover { background: var(--info-color); color: white; }

.btn-icon.success { background: rgba(46, 204, 113, 0.8); color: rgba(255, 255, 255, 0.8); }
.btn-icon.success:hover { background: var(--success-color); color: white; }

.btn-icon.danger { background: rgba(231, 76, 60, 0.8); color: rgba(255, 255, 255, 0.8); }
.btn-icon.danger:hover { background: var(--danger-color); color: white; }

.btn-icon.warning { background: rgba(241, 196, 15, 0.8); color: rgba(255, 255, 255, 0.8); }
.btn-icon.warning:hover { background: var(--warning-color); color: white; }

.btn-icon.myself {
    background-color: rgba(142, 68, 173, 0.2) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    cursor: not-allowed; box-shadow: none !important; transform: none !important;
}

/* ==========================================================================
   6. MODALE (Split View)
   ========================================================================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
    opacity: 0; animation: fadeIn 0.3s forwards;
}
@keyframes fadeIn { to { opacity: 1; } }

.modal-content {
    width: 900px; max-width: 95vw; max-height: 90vh;
    background: #1e1e2f; border-radius: 16px; border: 1px solid var(--glass-border);
    display: flex; flex-direction: column; overflow: hidden;
    transform: translateY(20px); animation: slideUp 0.3s 0.1s forwards;
}
@keyframes slideUp { to { opacity: 1; transform: translateY(0); } }

.user-header {
    background: linear-gradient(135deg, var(--primary-accent), var(--info-color));
    padding: 30px; display: flex; gap: 20px; align-items: center; color: white; position: relative;
}
.close-btn-absolute {
    position: absolute; top: 20px; right: 20px;
    background: rgba(0,0,0,0.2); border: none; color: white;
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
    margin: 0; padding: 0; /* Reset */
}

.modal-body-split { display: flex; flex: 1; overflow: hidden; height: 500px; }
.split-col { flex: 1; padding: 20px; display: flex; flex-direction: column; border-right: 1px solid rgba(255,255,255,0.05); }
.col-title { font-size: 1.1rem; font-weight: 600; color: #ccc; margin-bottom: 15px; display: flex; gap: 10px; }
.scrollable-list { flex: 1; overflow-y: auto; }

.list-item {
    padding: 12px; margin-bottom: 8px; border-radius: 8px;
    background: rgba(255,255,255,0.03); cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
}
.list-item.active { background: rgba(52, 152, 219, 0.15); border: 1px solid rgba(52,152,219,0.4); }
.list-item.active .item-name { color: var(--info-color); }
.check-icon { opacity: 0; color: var(--info-color); }
.list-item.active .check-icon { opacity: 1; }

.modal-footer-simple { padding: 15px; background: rgba(0,0,0,0.2); text-align: right; }
.modal-footer-simple button { width: auto; margin: 0; }

/* ==========================================================================
   7. RESPONSIVE (Mobile & Tablette)
   ========================================================================== */
@media (max-width: 768px) {
    body {
        /* Sur mobile, on préfère le scroll natif */
        overflow: auto;
        align-items: flex-start; /* Aligner en haut */
    }

    .portal-layout {
        flex-direction: column; /* Empilement Sidebar / Contenu */
        height: auto; /* Hauteur libre */
        min-height: 100vh;
        padding: 10px;
    }

    .portal-nav, .sidebar {
        width: 100%;
        height: auto; /* Plus de height: 100vh */
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
    
    /* On cache le footer déconnexion en bas de sidebar mobile si besoin d'espace,
       ou on le laisse couler naturellement */
    
    .portal-content, .main-content {
        height: auto; /* Plus de scroll interne, on scroll la page */
        overflow: visible;
        padding: 20px;
    }

    .app-grid {
        grid-template-columns: 1fr; /* 1 colonne sur mobile */
    }
    
    /* Modale Admin sur mobile */
    .modal-body-split {
        flex-direction: column;
        height: auto;
    }
    .split-col {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        max-height: 300px;
    }
}
