/* 
 * style.css - Feuille de style principale pour l'application de chat
 * Design minimaliste en tons de gris inspiré de WhatsApp
 */

/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    /* Palette de couleurs en tons de gris */
    --color-bg-light: #f8f9fa;
    --color-bg-main: #ffffff;
    --color-bg-dark: #eeeeee;
    --color-text-primary: #262626;
    --color-text-secondary: #666666;
    --color-text-muted: #999999;
    --color-border: #e0e0e0;
    --color-accent: #128C7E; /* Couleur d'accent WhatsApp */
    --color-accent-light: #25D366; /* Couleur secondaire WhatsApp */
    --color-error: #ff4d4f;
    --color-success: #52c41a;
    --color-message-sent: #e6e6e6;
    --color-message-received: #f0f0f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

body {
    background-color: var(--color-bg-light);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--color-accent-light);
}

button, .btn {
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 500;
    transition: var(--transition);
    background-color: var(--color-accent);
    color: white;
}

button:hover, .btn:hover {
    opacity: 0.9;
}

button:disabled, .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--color-bg-dark);
    color: var(--color-text-primary);
}

input, textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(18, 140, 126, 0.2);
}

/* Layout principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.auth-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 30px;
    background-color: var(--color-bg-main);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-primary);
}

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

.auth-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.auth-form .btn {
    width: 100%;
    margin-top: 10px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--color-text-secondary);
}

/* Chat Layout */
.chat-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 350px;
    background-color: var(--color-bg-main);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
}

.user-profile {
    display: flex;
    align-items: center;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-bg-dark);
    overflow: hidden;
    margin-right: 10px;
}

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

.user-name {
    font-weight: 600;
}

.sidebar-actions {
    display: flex;
    gap: 15px;
}

.icon-button {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: var(--transition);
}

.icon-button:hover {
    background-color: var(--color-bg-dark);
}

.search-container {
    padding: 10px 15px;
    border-bottom: 1px solid var(--color-border);
}

.search-input {
    position: relative;
}

.search-input input {
    padding-left: 40px;
    background-color: var(--color-bg-dark);
    border: none;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    padding: 12px 15px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: var(--transition);
}

.chat-item:hover {
    background-color: var(--color-bg-dark);
}

.chat-item.active {
    background-color: var(--color-bg-dark);
}

.chat-info {
    flex: 1;
    margin-left: 10px;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.chat-name {
    font-weight: 600;
    color: var(--color-text-primary);
}

.chat-time {
    font-size: 12px;
    color: var(--color-text-muted);
}

.chat-message {
    font-size: 13px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 5px;
}

.unread-badge {
    background-color: var(--color-accent);
    color: white;
    font-size: 12px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--color-bg-light);
}

.chat-header {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--color-bg-main);
    border-bottom: 1px solid var(--color-border);
}

.chat-header .user-profile {
    display: flex;
    align-items: center;
}

.chat-header .user-info {
    margin-left: 10px;
}

.user-status {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    position: relative;
}

.message-sent {
    align-self: flex-end;
    background-color: var(--color-message-sent);
    border-top-right-radius: 0;
}

.message-received {
    align-self: flex-start;
    background-color: var(--color-message-received);
    border-top-left-radius: 0;
}

.message-content {
    margin-bottom: 5px;
}

.message-time {
    text-align: right;
    font-size: 11px;
    color: var(--color-text-muted);
}

.message-status {
    display: inline-block;
    margin-left: 5px;
}

.message-status.read {
    color: var(--color-accent);
}

.chat-input {
    padding: 15px;
    background-color: var(--color-bg-main);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.attachment-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.attachment-btn:hover {
    background-color: var(--color-bg-dark);
}

.message-input {
    flex: 1;
    border-radius: var(--radius-lg);
    background-color: var(--color-bg-dark);
    border: none;
}

.send-btn {
    background-color: var(--color-accent);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Utilitaires */
.text-muted {
    color: var(--color-text-muted);
}

.text-error {
    color: var(--color-error);
}

.text-success {
    color: var(--color-success);
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

.hidden {
    display: none;
}

/* Animation de chargement */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--color-accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--radius-md);
    background-color: var(--color-bg-main);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification-success {
    border-left: 4px solid var(--color-success);
}

.notification-error {
    border-left: 4px solid var(--color-error);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 100vh;
        position: absolute;
        z-index: 10;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-chat {
        width: 100%;
    }
    
    .chat-header .back-btn {
        display: block;
    }
    
    .message {
        max-width: 85%;
    }
}
