/* ===== RESET & VARIABLES ===== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f2f5f9;
    color: #0b1a2f;
    line-height: 1.4;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-wrapper {
    max-width: 480px;
    width: 100%;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
}


/* ===== HEADER STYLISÉ ===== */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: white;
    border-bottom: 1px solid #f0f4fa;
    position: sticky;
    top: 0;
    z-index: 10;
}


/* Bouton retour avec style */

.back-button {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: #f0f4fc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #2c3e5c;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.back-button:hover {
    background: #e2e8f0;
    transform: scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}


/* Titre avec effet dégradé (inspiré du logo) */

.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(145deg, #2d3a5e, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    border-bottom: 3px solid rgba(79, 70, 229, 0.25);
    padding-bottom: 0.2rem;
    margin: 0;
}

.header-placeholder {
    width: 2.5rem;
    height: 2.5rem;
    opacity: 0;
}


/* ===== CONTENU PRINCIPAL ===== */

.conversations-container {
    flex: 1;
    padding: 0.75rem 0.75rem 1rem;
    background: white;
}


/* Loading spinner */

.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: #4f46e5;
    font-size: 0.95rem;
}


/* Messages d'alerte */

.error-message,
.success-message {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin: 0.5rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.error-message {
    background: #fff2f0;
    color: #c2410c;
    border-left: 4px solid #f97316;
}

.success-message {
    background: #e6f7e6;
    color: #0e7b32;
    border-left: 4px solid #2b9348;
}


/* ===== LISTE DES CONVERSATIONS ===== */

.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}


/* Carte conversation - design amélioré */

.conversation-card {
    background: white;
    border-radius: 1.5rem;
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    border: 1px solid #f0f4fa;
    box-shadow: 0 8px 18px -6px rgba(0, 0, 0, 0.08);
    position: relative;
}

.conversation-card.unread {
    background: #f5f8ff;
    border-color: #cbd5ff;
    box-shadow: 0 8px 18px -6px rgba(79, 70, 229, 0.15);
}

.conversation-card:active {
    background: #f9fcff;
    transform: scale(0.99);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}


/* Avatar */

.avatar {
    width: 3.5rem;
    height: 3.5rem;
    background: linear-gradient(145deg, #4f46e5, #7c5cf0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 6px 12px rgba(79, 70, 229, 0.25);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* Informations expéditeur */

.sender-info {
    flex: 1;
    min-width: 0;
}

.sender-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.anonymous-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: #0b1a2f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.last-time {
    font-size: 0.7rem;
    color: #8a9bb5;
    font-weight: 400;
    white-space: nowrap;
    padding-left: 0.5rem;
}

.message-preview {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #546e7a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-preview i {
    color: #4f46e5;
    font-size: 0.7rem;
    opacity: 0.8;
}

.unread-badge {
    background: #4f46e5;
    color: white;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.2rem 0.7rem;
    border-radius: 1rem;
    margin-left: 0.5rem;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}


/* Menu trois points - toujours à droite */

.card-menu {
    position: relative;
    flex-shrink: 0;
    margin-left: auto;
    /* pousse le menu à l'extrémité droite */
}

.menu-button {
    background: transparent;
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7f8fa4;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-button:hover {
    background: #f0f4fc;
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 1.2rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 190px;
    z-index: 100;
    display: none;
    border: 1px solid #edf2f9;
    overflow: hidden;
    padding: 0.25rem;
}

.menu-dropdown.show {
    display: block;
}

.menu-item {
    width: 100%;
    padding: 0.8rem 1rem;
    border: none;
    background: white;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
    color: #1e293b;
    border-radius: 0.8rem;
}

.menu-item:hover {
    background: #f1f5f9;
}

.menu-item.danger {
    color: #ef4444;
}

.menu-item.danger:hover {
    background: #fef2f2;
}


/* Aucune conversation */

.no-conversations {
    text-align: center;
    padding: 3rem 1rem;
    color: #64748b;
}

.no-conversations i {
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.no-conversations p {
    margin-bottom: 1.5rem;
}

.btn-primary {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: #4f46e5;
    color: white;
    text-decoration: none;
    border-radius: 2rem;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: #6366f1;
    transform: translateY(-2px);
}


/* ===== MODAL ===== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 1.8rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    font-size: 1.3rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: #475569;
    margin-bottom: 1.8rem;
    font-size: 0.95rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.modal-actions .btn-cancel,
.modal-actions .btn-confirm {
    width: 100%;
    padding: 0.9rem;
    border-radius: 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    border: none;
    font-size: 1rem;
}

.btn-cancel {
    background: #f1f5f9;
    color: #475569;
}

.btn-confirm {
    background: #4f46e5;
    color: white;
}

.btn-cancel:hover {
    background: #e2e8f0;
}

.btn-confirm:hover {
    background: #6366f1;
}

.btn-confirm.danger {
    background: #ef4444;
}

.btn-confirm.danger:hover {
    background: #dc2626;
}


/* ===== RESPONSIVE (déjà mobile-first) ===== */

@media (min-width: 768px) {
    .app-wrapper {
        max-width: 600px;
        margin: 1rem auto;
        min-height: auto;
        border-radius: 2rem;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    }
    .modal-actions {
        flex-direction: row;
    }
}