/* RESET & FONTS */
:root {
    --primary: #0056b3;
    --primary-dark: #004494;
    --bg-light: #f4f7fa;
    --text-dark: #2d3436;
    --text-gray: #636e72;
    --white: #ffffff;
    --danger: #d63031;
    --sidebar-width: 260px;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif; /* Police moderne */
    margin: 0;
    background-color: var(--bg-light);
    color: var(--text-dark);
}

/* --- LAYOUT DASHBOARD --- */
.dash-body {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid #e1e8ef;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    z-index: 100;
}

.brand { padding: 30px; text-align: center; border-bottom: 1px solid #f0f0f0; }
.brand img { height: 35px; }

.sidebar nav { flex: 1; padding-top: 20px; }
.sidebar nav a {
    display: flex;
    align-items: center;
    padding: 15px 30px;
    color: var(--text-gray);
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s;
    gap: 15px;
}
.sidebar nav a:hover, .sidebar nav a.active {
    color: var(--primary);
    background: #f0f7ff;
    border-right: 3px solid var(--primary);
}

.logout-area { padding: 20px; border-top: 1px solid #f0f0f0; }
.logout-area a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--danger);
    text-decoration: none;
    font-weight: 500;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
}

/* HEADER */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}
.welcome-text h1 { margin: 0; font-size: 24px; font-weight: 700; }
.welcome-text p { margin: 5px 0 0; color: var(--text-gray); font-size: 14px; }

.profile-widget { display: flex; align-items: center; gap: 15px; }
.text-right { text-align: right; }
.name { display: block; font-weight: 600; font-size: 15px; }
.role { display: block; font-size: 12px; color: var(--text-gray); }
.avatar { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }

/* CARDS */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    border: 1px solid #eef2f6;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #f5f5f5;
    padding-bottom: 15px;
}
.card-header h3 { margin: 0; font-size: 16px; color: var(--primary); font-weight: 600; }

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
}
.label { color: var(--text-gray); }
.value { font-weight: 500; }

.btn-sm { font-size: 12px; color: var(--primary); text-decoration: none; font-weight: 600; }
.btn-danger-outline {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.2s;
}
.btn-danger-outline:hover { background: var(--danger); color: white; }

.sec-desc { font-size: 13px; color: var(--text-gray); margin-bottom: 15px; }
.sec-badge { margin-top: 15px; font-size: 12px; color: #27ae60; display: flex; align-items: center; gap: 5px; }

/* TABLEAU HISTORIQUE */
.history-section h3 { margin-bottom: 20px; font-size: 18px; }

.table-responsive {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    border: 1px solid #eef2f6;
}
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 15px 20px; background: #f8f9fa; font-size: 12px; text-transform: uppercase; color: var(--text-gray); letter-spacing: 0.5px; }
td { padding: 15px 20px; border-bottom: 1px solid #f0f0f0; font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* Icones Service */
.service-cell { display: flex; align-items: center; gap: 12px; }
.service-icon { width: 24px; height: 24px; border-radius: 4px; }
.icon-placeholder { width: 24px; height: 24px; background: #e0e0e0; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #666; }
.icon-placeholder.login { background: #e3f2fd; color: var(--primary); }
.service-name { font-weight: 500; }

/* Badges */
.badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-app { background: #e8f5e9; color: #27ae60; }
.badge-login { background: #e3f2fd; color: #0984e3; }

/* Bouton Reveal IP */
.btn-reveal { background: none; border: none; color: var(--text-gray); cursor: pointer; text-decoration: underline; font-size: 12px; }
.ip-hidden { display: none; font-family: monospace; background: #eee; padding: 2px 5px; border-radius: 3px; font-size: 12px; margin-left: 5px; }

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .dash-body { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid #eee; }
    .sidebar nav { display: flex; overflow-x: auto; padding: 0; }
    .sidebar nav a { padding: 15px; font-size: 12px; flex-direction: column; gap: 5px; }
    .logout-area { display: none; }
    .main-content { margin-left: 0; padding: 20px; }
    .dash-header { flex-direction: column; align-items: flex-start; gap: 20px; }
    .profile-widget { width: 100%; justify-content: space-between; }
    .text-right { text-align: left; }
}

/* --- STYLE PAGE PROFIL --- */

/* On élargit un peu le conteneur pour le confort */
.profile-container {
    max-width: 500px;
    padding: 35px 40px;
}

/* Header Avatar */
.profile-header {
    margin-bottom: 30px;
    text-align: center;
}

.profile-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.profile-header h2 { margin: 0 0 5px 0; font-size: 22px; color: var(--text-dark); }
.profile-header p { margin: 0; color: var(--text-gray); font-size: 14px; }

/* Formulaire Design */
.profile-form { text-align: left; }

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label i { color: var(--primary); }

/* Inputs stylisés */
.profile-form input[type="text"], 
.profile-form input[type="tel"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e1e8ef;
    border-radius: 8px;
    font-size: 15px;
    background: #f9fafb;
    transition: all 0.2s;
    box-sizing: border-box; /* Important pour ne pas dépasser */
}

.profile-form input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
    outline: none;
}

/* Grille pour Nom/Prénom */
.form-row {
    display: flex;
    gap: 15px;
}
.form-row .form-group {
    flex: 1; /* Prend 50% chacun */
}

/* Bouton Save */
.btn-save {
    width: 100%;
    padding: 14px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-save:hover {
    background-color: var(--primary-dark);
}

.btn-save:active {
    transform: scale(0.98);
}

/* Mobile responsive pour le formulaire */
@media (max-width: 480px) {
    .form-row { flex-direction: column; gap: 0; }
    .profile-container { padding: 25px; }
}
/* --- ALERT BOX (PREMIERE CONNEXION) --- */
.warning-box {
    background-color: #fff8e1; /* Fond jaune très clair */
    border: 1px solid #ffe082; /* Bordure jaune */
    border-left: 4px solid #ffca28; /* Grosse barre à gauche */
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 25px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    text-align: left;
    animation: fadeIn 0.5s ease-in-out;
}

.warning-box i {
    color: #f57c00; /* Orange foncé pour l'icone */
    font-size: 20px;
    margin-top: 2px;
}

.warning-text strong {
    display: block;
    color: #e65100;
    font-size: 14px;
    margin-bottom: 3px;
}

.warning-text p {
    margin: 0;
    color: #5d4037;
    font-size: 13px;
    line-height: 1.4;
}

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