/* ===== Variables CSS ===== */
:root {
    --primary-color: #6C5CE7;
    --secondary-color: #00B894;
    --accent-color: #FD79A8;
    --warning-color: #FDCB6E;
    --danger-color: #FF7675;
    --info-color: #74B9FF;
    --dark-bg: #2D3436;
    --light-bg: #F8F9FA;
    --card-bg: #FFFFFF;
    --text-dark: #2D3436;
    --text-light: #636E72;
    --border-color: #DFE6E9;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #2D3436 0%, #1e272e 100%);
    padding: 2rem 0;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
    margin-bottom: 3rem;
}

.logo-image {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 12px;
    transition: var(--transition);
}

.logo-image:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(253, 121, 168, 0.3);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: #B2BEC3;
    text-decoration: none;
    border-radius: 12px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
}

.nav-item:hover {
    background: rgba(108, 92, 231, 0.1);
    color: var(--primary-color);
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

/* ===== Main Content ===== */
.main-content {
    margin-left: 280px;
    min-height: 100vh;
    background: var(--light-bg);
}

.top-bar {
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--light-bg);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    width: 400px;
}

.search-box i {
    color: var(--text-light);
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info i {
    font-size: 1.3rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.user-info i:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

/* ===== Pages ===== */
.page {
    display: none;
    padding: 2rem;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.stat-purple .stat-icon {
    background: linear-gradient(135deg, #6C5CE7, #A29BFE);
}

.stat-blue .stat-icon {
    background: linear-gradient(135deg, #0984E3, #74B9FF);
}

.stat-green .stat-icon {
    background: linear-gradient(135deg, #00B894, #55EFC4);
}

.stat-orange .stat-icon {
    background: linear-gradient(135deg, #FD79A8, #FDCB6E);
}

.stat-info h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-info p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.card-header h3 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-content {
    padding: 1.5rem;
}

.project-list, .deadline-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-item, .deadline-item {
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.project-item:hover, .deadline-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.project-item h4, .deadline-item h4 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.project-item p, .deadline-item p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ===== Table ===== */
.table-container {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.data-table th {
    padding: 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--light-bg);
}

.data-table td {
    padding: 1.25rem;
    color: var(--text-dark);
}

.status-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-actif {
    background: rgba(0, 184, 148, 0.1);
    color: var(--secondary-color);
}

.status-inactif {
    background: rgba(255, 118, 117, 0.1);
    color: var(--danger-color);
}

.status-prospect {
    background: rgba(253, 203, 110, 0.1);
    color: var(--warning-color);
}

/* ===== Planning ===== */
.planning-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-dark);
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-color: transparent;
}

.planning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.task-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-left: 4px solid;
    position: relative;
}

.task-card.priority-haute {
    border-left-color: var(--danger-color);
}

.task-card.priority-moyenne {
    border-left-color: var(--warning-color);
}

.task-card.priority-basse {
    border-left-color: var(--info-color);
}

.task-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.task-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.task-description {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.task-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.task-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.task-meta-item i {
    width: 16px;
    color: var(--primary-color);
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.task-status-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-todo {
    background: rgba(116, 185, 255, 0.1);
    color: var(--info-color);
}

.status-in-progress {
    background: rgba(253, 203, 110, 0.1);
    color: var(--warning-color);
}

.status-completed {
    background: rgba(0, 184, 148, 0.1);
    color: var(--secondary-color);
}

/* ===== Buttons ===== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.3);
}

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

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-edit {
    background: rgba(108, 92, 231, 0.1);
    color: var(--primary-color);
}

.btn-edit:hover {
    background: var(--primary-color);
    color: white;
}

.btn-delete {
    background: rgba(255, 118, 117, 0.1);
    color: var(--danger-color);
}

.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-in-out;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-in-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.3rem;
}

.close {
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.close:hover {
    transform: rotate(90deg);
}

.modal form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.95rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-style: italic;
}

.empty-state-large {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state-large i {
    font-size: 4rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

.empty-state-large p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
    }
    
    .search-box {
        width: 300px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .planning-grid {
        grid-template-columns: 1fr;
    }
    
    .search-box {
        width: 200px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}



/* ===== Chat Styles ===== */
.badge {
    display: inline-block;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    min-width: 20px;
    text-align: center;
}

.badge:empty {
    display: none;
}

.chat-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 0;
    height: calc(100vh - 200px);
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.chat-sidebar {
    border-right: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--light-bg);
}

.chat-search {
    padding: 1.5rem;
    background: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-search i {
    color: var(--text-light);
}

.chat-search input {
    border: none;
    background: var(--light-bg);
    padding: 0.75rem 1rem;
    border-radius: 50px;
    width: 100%;
    outline: none;
    transition: var(--transition);
}

.chat-search input:focus {
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

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

.conversation-item {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--card-bg);
}

.conversation-item:hover {
    background: var(--light-bg);
}

.conversation-item.active {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(253, 121, 168, 0.1));
    border-left: 4px solid var(--primary-color);
}

.conversation-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

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

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.conversation-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.conversation-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.conversation-preview {
    color: var(--text-light);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item.unread .conversation-preview {
    color: var(--text-dark);
    font-weight: 600;
}

.conversation-item.unread .conversation-name {
    color: var(--primary-color);
}

.unread-badge {
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Chat Main */
.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
}

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
}

.chat-empty i {
    font-size: 5rem;
    color: var(--border-color);
    margin-bottom: 1.5rem;
}

.chat-empty h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.chat-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.chat-header-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.chat-header-info {
    flex: 1;
}

.chat-header-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.chat-header-status {
    font-size: 0.85rem;
    opacity: 0.9;
}

.chat-header-status.online::before {
    content: '●';
    color: var(--secondary-color);
    margin-right: 0.5rem;
}

.chat-header-status.offline::before {
    content: '●';
    color: var(--text-light);
    margin-right: 0.5rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
}

.message {
    display: flex;
    gap: 1rem;
    animation: messageSlide 0.3s ease-in-out;
}

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

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.message.sent .message-avatar {
    background: linear-gradient(135deg, var(--secondary-color), var(--info-color));
}

.message-content {
    max-width: 60%;
}

.message-bubble {
    background: var(--card-bg);
    padding: 1rem 1.25rem;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
}

.message.sent .message-bubble {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.message-text {
    line-height: 1.5;
    font-size: 0.95rem;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    display: block;
}

.message.sent .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.8);
}

.chat-input-container {
    padding: 1.5rem;
    background: var(--card-bg);
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--light-bg);
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    border: 2px solid transparent;
    transition: var(--transition);
}

.chat-input:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.chat-input input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.95rem;
}

.chat-input-actions {
    display: flex;
    gap: 0.5rem;
}

.chat-input-actions i {
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.chat-input-actions i:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.btn-send {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.3);
}

.btn-send:active {
    transform: scale(0.95);
}

/* Date Separator */
.date-separator {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.date-separator span {
    background: var(--light-bg);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
}

/* Responsive Chat */
@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr;
    }
    
    .chat-sidebar {
        display: none;
    }
    
    .chat-sidebar.active {
        display: flex;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 100;
    }
    
    .message-content {
        max-width: 80%;
    }
}



/* ===== Attachment Styles ===== */
.message-attachment {
    margin-top: 0.5rem;
}

.attachment-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: block;
}

.attachment-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.attachment-file {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-top: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    max-width: 300px;
}

.message.sent .attachment-file {
    background: rgba(255, 255, 255, 0.2);
}

.message.received .attachment-file {
    background: var(--light-bg);
}

.attachment-file:hover {
    background: rgba(108, 92, 231, 0.1);
    transform: translateX(5px);
}

.attachment-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.attachment-icon.pdf {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.attachment-icon.doc {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
    color: white;
}

.attachment-icon.xls {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    color: white;
}

.attachment-icon.zip {
    background: linear-gradient(135deg, #f39c12, #d68910);
    color: white;
}

.attachment-icon.txt {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.attachment-icon.default {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

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

.attachment-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.message.sent .attachment-name {
    color: white;
}

.attachment-size {
    font-size: 0.75rem;
    color: var(--text-light);
}

.message.sent .attachment-size {
    color: rgba(255, 255, 255, 0.8);
}

.attachment-download {
    color: var(--primary-color);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message.sent .attachment-download {
    color: white;
}

/* Preview modal for images */
.image-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.image-preview-modal.active {
    display: flex;
}

.image-preview-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.image-preview-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: white;
    color: var(--text-dark);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    transition: var(--transition);
}

.image-preview-close:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

/* File upload progress */
.upload-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.upload-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
}

.upload-progress-text {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
}

