/* ===== DASHBOARD CARDS ===== */
.dashboard-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    text-align: center;
    transition: 0.3s;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

.dashboard-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
}

/* ===== USER MENU ===== */
.user-name { font-weight: 600; }

.user-menu {
    position: relative;
    display: inline-block;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.user-info img { border-radius: 50%; }

.dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 45px;
    background: #fff;
    min-width: 260px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 10px 0;
    z-index: 999;
}

.user-menu:hover .dropdown { display: block; }

.user-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.user-header img,
.user-info img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
}

.user-meta strong { display: block; font-size: 14px; }
.user-meta small  { color: #777; font-size: 12px; }

.dropdown a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.dropdown a:hover { background: #f5f5f5; }

.user-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
    background: #FAF9F6;
}

.sidebar {
    width: 260px;
    background: #0f172a;
    color: #fff;
    padding: 20px;
    min-height: 100vh;
}

.sidebar a {
    display: block;
    padding: 12px;
    color: #cbd5e1;
    text-decoration: none;
    margin-top: 8px;
    border-radius: 8px;
    transition: 0.2s;
}

.sidebar a:hover,
.active-link {
    background: #1e293b !important;
    color: #fff !important;
}

.user-box {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-box h3 {
    color: #fff;
    font-size: 15px;
    margin: 0;
}

.sidebar-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    display: block;
    margin: 0 auto 10px auto;
}

.dashboard-content {
    flex: 1;
    padding: 20px 30px;
}

/* ===== SECTIONS ===== */
.dash-section {
    display: none !important;
}

/* ===== PROFIL ===== */
#section-profil h2    { display: none !important; }
#section-profil       { padding-top: 0 !important; margin-top: 0 !important; }

.cover-box {
    position: relative !important;
    width: 100% !important;
    height: 250px !important;
    margin-bottom: 80px !important;
    overflow: visible !important;
    border-radius: 12px !important;
}

.cover-img {
    position: absolute !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important;
    height: 250px !important;
    object-fit: cover !important;
    border-radius: 12px !important;
    display: block !important;
}

.cover-placeholder {
    position: absolute !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important;
    height: 250px !important;
    background: linear-gradient(135deg, #1e293b, #3b82f6) !important;
    border-radius: 12px !important;
    display: block !important;
}

.avatar-box {
    position: absolute !important;
    bottom: -60px !important;
    left: 30px !important;
    z-index: 10 !important;
}

.avatar-img {
    width: 120px !important;
    height: 120px !important;
    border-radius: 50% !important;
    border: 5px solid #fff !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
    object-fit: cover !important;
    display: block !important;
    background: #e5e7eb !important;
}

.upload-row {
    display: flex !important;
    gap: 20px !important;
    margin-top: 75px !important;
    margin-bottom: 15px !important;
    flex-wrap: wrap !important;
}

.upload-item              { flex: 1 !important; min-width: 200px !important; }
.upload-item label        { display: block !important; font-size: 13px !important; color: #3b82f6 !important; margin-bottom: 5px !important; font-weight: 500 !important; }
.upload-item input[type="file"] { font-size: 13px !important; width: 100% !important; }

.form-fields { margin-top: 10px !important; }

.form-fields input[type="text"],
.form-fields input[type="email"],
.form-fields input[type="password"] {
    display: block !important;
    width: 100% !important;
    padding: 11px 14px !important;
    margin-top: 10px !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
    background: #fff !important;
    color: #0f172a !important;
    outline: none !important;
}

.form-fields input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1) !important;
}

.form-fields button[name="update_profile"] {
    margin-top: 20px !important;
    padding: 12px 24px !important;
    background: #3b82f6 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 15px !important;
    width: 100% !important;
    font-weight: 600 !important;
    transition: 0.3s !important;
}

.form-fields button[name="update_profile"]:hover {
    background: #2563eb !important;
    transform: translateY(-2px) !important;
}

/* ===== POPUP SUCCÈS ===== */
.cdej-popup-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cdej-popup-box {
    background: #fff;
    padding: 35px 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    max-width: 350px;
    width: 90%;
    animation: popupIn 0.3s ease;
}

@keyframes popupIn {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.cdej-popup-icon { font-size: 48px; margin-bottom: 15px; }
.cdej-popup-box h3 { font-size: 20px; color: #0f172a; margin-bottom: 8px; }
.cdej-popup-box p  { font-size: 14px; color: #64748b; margin-bottom: 20px; }

.cdej-popup-close {
    padding: 10px 30px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
}

.cdej-popup-close:hover { background: #2563eb; }

/* ===== NOTIFICATIONS ===== */
.notif-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: 0.2s;
    border-left: 4px solid #3b82f6;
}

.notif-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.notif-nonlu { border-left-color: #3b82f6 !important; background: #f0f7ff !important; }
.notif-lu    { border-left-color: #e2e8f0 !important; background: #fff !important; opacity: 0.8; }

.notif-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    cursor: pointer !important;
    user-select: none;
}

.notif-icon           { font-size: 24px; flex-shrink: 0; }
.notif-meta           { flex: 1; }
.notif-meta strong    { display: block; font-size: 15px; color: #0f172a; }
.notif-meta small     { color: #94a3b8; font-size: 12px; }

.notif-badge {
    background: #3b82f6;
    color: #fff;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.notif-arrow  { font-size: 12px; color: #94a3b8; margin-left: 8px; }
.notif-body p { font-size: 14px; color: #475569; margin: 0 0 8px 0; }

.notif-fichier {
    display: inline-block;
    padding: 7px 14px;
    background: #f1f5f9;
    color: #3b82f6 !important;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none !important;
    font-weight: 500;
}

.notif-fichier:hover { background: #e2e8f0; }

.notif-empty {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 16px;
}

/* ===== CHAT DESKTOP ===== */
.chat-layout {
    display: flex;
    height: 600px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
}

.chat-contacts {
    width: 280px;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    flex-shrink: 0;
}

.chat-contacts-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-contacts-header h3 { margin: 0; font-size: 16px; color: #0f172a; }

#contactsList { flex: 1; overflow-y: auto; }

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: 0.2s;
}

.contact-item:hover,
.contact-item.active { background: #e2e8f0; }

.contact-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.contact-info     { flex: 1; min-width: 0; }
.contact-name     { font-size: 14px; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-last-msg { font-size: 12px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }

.contact-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.contact-date  { font-size: 11px; color: #94a3b8; }

.contact-unread {
    background: #3b82f6;
    color: #fff;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 20px;
    font-weight: 600;
}

.chat-new { padding: 12px; border-top: 1px solid #e2e8f0; }

.chat-new-btn {
    width: 100%;
    padding: 8px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

.chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 16px;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
}

.chat-header strong { font-size: 15px; color: #0f172a; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f1f5f9;
}

.chat-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-bubble small {
    display: block;
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

.chat-bubble.mine   { background: #3b82f6; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-bubble.theirs { background: #fff; color: #0f172a; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.06); }

.chat-input-area {
    padding: 12px 15px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input-area input[type="text"] {
    flex: 1 !important;
    padding: 10px 14px !important;
    border-radius: 25px !important;
    border: 1px solid #e2e8f0 !important;
    font-size: 14px !important;
    outline: none !important;
    margin: 0 !important;
}

.chat-send-btn {
    background: #3b82f6 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.chat-file-btn {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== DESKTOP ONLY ===== */
.sidebar-toggle { display: none; }
.chat-back-btn  { display: none; }

/* ===== ACCUEIL ===== */
.accueil-box {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    margin-bottom: 25px;
}

.accueil-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #f0f7ff;
    flex-shrink: 0;
}

.accueil-text h2 {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin: 0 0 5px 0 !important;
    display: block !important;
}

.accueil-text p { font-size: 14px; color: #64748b; margin: 0; }

.accueil-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.accueil-card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
    border-left: 4px solid #3b82f6;
}

.accueil-card:hover { transform: translateY(-4px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }

.accueil-card-icon { font-size: 30px; display: block; margin-bottom: 8px; }
.accueil-card strong { display: block; font-size: 15px; color: #0f172a; margin-bottom: 4px; }
.accueil-card small  { font-size: 12px; color: #94a3b8; }

/* ===== AVATARS ===== */
.sidebar .sidebar-avatar,
.user-box .sidebar-avatar {
    border-radius: 50% !important;
    width: 80px !important;
    height: 80px !important;
    object-fit: cover !important;
}

.contact-avatar {
    border-radius: 50% !important;
    width: 42px !important;
    height: 42px !important;
    object-fit: cover !important;
}

/* ===== BOUTON TOGGLE SECTIONS MOBILE ===== */
.section-mobile-header { display: none; }

/* ===== MOBILE ===== */
@media (max-width: 768px) {

    /* Sidebar */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        width: 250px;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        min-height: 100vh;
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 9998;
    }

    .sidebar-overlay.open { display: block; }

    /* Layout */
    .dashboard-layout {
        flex-direction: column;
        min-height: 100vh;
    }

    .dashboard-content {
        width: 100% !important;
        padding: 15px !important;
        margin-left: 0 !important;
    }

    /* Toggle button */
    .sidebar-toggle {
        display: flex !important;
        position: static !important;
        background: #0f172a !important;
        color: #fff !important;
        border: none !important;
        border-radius: 8px !important;
        font-size: 18px !important;
        cursor: pointer !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: none !important;
    }

    /* Section mobile header */
    .section-mobile-header {
        display: flex;
        justify-content: flex-end;
        padding: 8px 0 12px 0;
    }

    .sidebar-toggle-inner,
    .chat-contacts-header .sidebar-toggle-inner {
        background: #0f172a;
        color: #fff;
        border: none;
        border-radius: 8px;
        width: 36px;
        height: 36px;
        font-size: 18px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Profil mobile */
    .cover-box { height: 150px !important; margin-bottom: 60px !important; }
    .cover-img, .cover-placeholder { height: 150px !important; }
    .avatar-box  { bottom: -40px !important; left: 15px !important; }
    .avatar-img  { width: 80px !important; height: 80px !important; }
    .upload-row  { flex-direction: column !important; gap: 10px !important; margin-top: 55px !important; }

    /* Notifications mobile */
    .notif-card       { padding: 8px 12px !important; margin-bottom: 6px !important; }
    .notif-icon       { font-size: 16px !important; }
    .notif-meta strong { font-size: 13px !important; }
    .notif-meta small  { font-size: 11px !important; }
    .notif-badge      { font-size: 10px !important; padding: 2px 7px !important; }
    .notif-body p     { font-size: 13px !important; }

    /* Accueil mobile */
    .accueil-box {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
    }

    .accueil-cards { grid-template-columns: 1fr; gap: 10px; }
    .accueil-text h2 { font-size: 18px !important; }

    /* Chat mobile plein écran */
    .chat-layout {
        position: fixed !important;
        top: 0 !important; left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 8000 !important;
        flex-direction: column !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        height: -webkit-fill-available !important;
    }

    .chat-contacts {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid #e2e8f0 !important;
        max-height: 100vh !important;
        flex: 1 !important;
        display: flex !important;
    }

    .chat-contacts.hidden-mobile { display: none !important; }

    #contactsList { max-height: calc(100vh - 180px) !important; overflow-y: auto !important; }

    .chat-main {
        position: fixed !important;
        top: 0 !important; left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: -webkit-fill-available !important;
        z-index: 8001 !important;
        display: none !important;
        flex-direction: column !important;
        background: #f1f5f9 !important;
        overflow: hidden !important;
    }

    .chat-main.open-mobile { display: flex !important; }

    .chat-header {
        padding: 12px 15px !important;
        background: #0f172a !important;
        color: #fff !important;
        flex-shrink: 0 !important;
    }

    .chat-header strong { color: #fff !important; }

    .chat-back-btn {
        display: inline-flex !important;
        align-items: center !important;
        background: none !important;
        border: none !important;
        color: #fff !important;
        font-size: 20px !important;
        cursor: pointer !important;
        margin-right: 10px !important;
        padding: 0 !important;
    }

    .chat-messages {
        flex: 1 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 10px !important;
        min-height: 0 !important;
    }

    .chat-bubble { max-width: 85% !important; font-size: 13px !important; }

    .chat-input-area {
        position: relative !important;
        bottom: auto !important;
        flex-shrink: 0 !important;
        padding: 8px 10px !important;
        background: #fff !important;
        border-top: 1px solid #e2e8f0 !important;
    }

    .chat-input-area input[type="text"] {
        font-size: 16px !important;
        -webkit-appearance: none !important;
    }
}
