/* Import des variables et styles globaux */
@import url('./variables.css');
@import url('./global.css');

/* === STYLES HEADER ET NAVIGATION === */
/* Header styles supprimés - définis dans header.css pour éviter les conflits */

/* === STYLES DES PAGES === */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 28px;
    color: var(--bleu-nuit);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--gris-texte);
    font-size: 16px;
}

/* === STYLES DES CARTES ET STATISTIQUES === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--blanc);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--beige-clair);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bleu-new-agency);
    font-size: 20px;
    margin-bottom: 16px;
}

.stat-content h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--bleu-nuit);
    margin-bottom: 8px;
}

.stat-content p {
    color: var(--gris-texte);
    font-size: 14px;
}

/* === CARDS ET COMPOSANTS === */
.card {
    background: var(--blanc);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e1e1e1;
    background: var(--gris-light);
}

.card-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: var(--bleu-new-agency);
    margin: 0;
}

/* === BOUTONS === */
.btn-primary {
    background: var(--bleu-new-agency);
    color: var(--blanc);
    border: 0;
    border-radius: 6px;
    padding: 12px 24px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--bleu-nuit);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--bleu-new-agency);
    border: 2px solid var(--bleu-new-agency);
    border-radius: 6px;
    padding: 10px 22px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: var(--bleu-new-agency);
    color: var(--blanc);
}

/* === TABLEAUX === */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--blanc);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e1e1e1;
}

.table th {
    background: var(--gris-light);
    font-weight: 600;
    color: var(--bleu-new-agency);
}

.table tr:hover {
    background: var(--beige-clair);
}

/* === BADGES === */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: var(--beige-clair);
    color: var(--bleu-new-agency);
}

/* === FORMULAIRES === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--gris-texte);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: var(--blanc);
}

.form-control:focus {
    outline: none;
    border-color: var(--bleu-new-agency);
    box-shadow: 0 0 0 3px rgba(18, 62, 107, 0.1);
}

/* === MESSAGERIE === */
.messaging-container {
    display: flex;
    height: calc(100vh - 200px);
    background: var(--blanc);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.contacts-sidebar {
    width: 300px;
    border-right: 1px solid #e1e1e1;
    display: flex;
    flex-direction: column;
}

.contacts-header {
    padding: 20px;
    border-bottom: 1px solid #e1e1e1;
    background: var(--gris-light);
}

.contacts-header h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--bleu-new-agency);
    margin: 0;
}

.contacts-search {
    margin-top: 12px;
    position: relative;
}

.contacts-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    font-size: 14px;
}

.contacts-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--beige-sable);
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
}

.contact-item:hover {
    background: var(--beige-clair);
}

.contact-item.active {
    background: var(--bleu-new-agency);
    color: var(--blanc);
}

.contact-item.active .contact-avatar {
    background: var(--blanc);
    color: var(--bleu-new-agency);
}

.contact-avatar {
    width: 40px;
    height: 40px;
    background: var(--beige-sable);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blanc);
    font-size: 16px;
    flex-shrink: 0;
}

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

.contact-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-role {
    font-size: 12px;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-item.active .contact-role {
    opacity: 0.9;
}

.conversation-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.conversation-header {
    padding: 20px;
    border-bottom: 1px solid #e1e1e1;
    background: var(--gris-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.conversation-avatar {
    width: 40px;
    height: 40px;
    background: var(--beige-sable);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blanc);
    font-size: 16px;
}

.conversation-info h4 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--bleu-new-agency);
    margin: 0 0 2px 0;
}

.conversation-info p {
    font-size: 12px;
    color: var(--gris-texte);
    opacity: 0.8;
    margin: 0;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--gris-light);
}

.message-item {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.message-item.sent {
    flex-direction: row-reverse;
}

.message-item.received {
    flex-direction: row;
}

.message-avatar {
    width: 32px;
    height: 32px;
    background: var(--beige-sable);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blanc);
    font-size: 12px;
    flex-shrink: 0;
}

.message-item.sent .message-avatar {
    background: var(--bleu-new-agency);
}

.message-item.received .message-avatar {
    background: var(--beige-sable);
}

.message-date-separator {
    text-align: center;
    margin: 24px 0;
    position: relative;
    color: var(--gris-texte);
    opacity: 0.6;
    font-size: 12px;
}

.message-date-separator::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: #e1e1e1;
    z-index: 1;
}

.date-bubble {
    background: var(--blanc);
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
    position: relative;
    z-index: 2;
    border: 1px solid #e1e1e1;
}

.attachment-preview {
    background: var(--gris-light);
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.attachment-preview i {
    color: var(--beige-sable);
}

.attachment-preview .remove-attachment {
    margin-left: auto;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
}

.attachment-tab {
    background: var(--gris-light);
    border-top: 1px solid #e1e1e1;
    padding: 12px 20px;
}

.attachment-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--gris-texte);
    opacity: 0.8;
}

.attachment-tab-close {
    background: none;
    border: none;
    color: var(--gris-texte);
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
}

.attachment-tab-close:hover {
    color: #dc3545;
}

.attachment-tab-content {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.attachment-item {
    background: var(--blanc);
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.attachment-item i {
    color: var(--beige-sable);
}

.attachment-item-name {
    font-weight: 600;
    color: var(--bleu-new-agency);
}

.attachment-item-size {
    color: var(--gris-texte);
    opacity: 0.8;
}

.message-content {
    max-width: 70%;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
}

.message-item.sent .message-time {
    text-align: right;
}

.message-item.received .message-time {
    text-align: left;
}

.message-input-area {
    border-top: 1px solid #e1e1e1;
    padding: 20px;
    background: var(--blanc);
}

.message-input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--gris-light);
    border-radius: 8px;
    padding: 12px;
}

.message-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    min-height: 20px;
    max-height: 100px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.action-btn {
    background: none;
    border: none;
    color: var(--beige-sable);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 16px;
}

.action-btn:hover {
    background: var(--beige-clair);
    color: var(--bleu-new-agency);
}

.attachment-btn {
    color: var(--beige-sable);
}

.attachment-btn:hover {
    color: var(--bleu-new-agency);
}

.send-btn {
    color: var(--bleu-new-agency);
}

.send-btn:hover {
    background: var(--bleu-new-agency);
    color: var(--blanc);
}

.unread-badge {
    background: #dc3545;
    color: var(--blanc);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        top: 80px;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 999;
        height: calc(100vh - 80px);
    }

    .sidebar.show {
        left: 0;
    }

    /* Header padding supprimé - géré dans header.css */

    .content {
        margin-left: 0;
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .messaging-container {
        flex-direction: column;
        height: calc(100vh - 160px);
    }

    .contacts-sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #e1e1e1;
    }

    .conversation-area {
        flex: 1;
    }

    /* Exception pour la page messagerie admin - suppression de tous les espacements sur mobile aussi */
    .content #messaging_admin {
        padding: 0 !important;
        margin: 0 !important;
        height: calc(100vh - 80px) !important;
        max-height: calc(100vh - 80px) !important;
        overflow: hidden !important;
        background: transparent !important;
    }

    /* Règle spécifique pour supprimer le padding du content quand la page messagerie admin est active sur mobile */
    .content[data-active-page="messaging_admin"] {
        padding: 0 !important;
        margin: 0 !important;
        margin-left: 0 !important; /* Pas de marge sur mobile */
        background: transparent !important;
    }
}