/* ============================================================
   NETWORKSPACE - Design System Premium
   Plateforme de Communication Interne
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   1. CSS VARIABLES / DESIGN TOKENS
   ============================================================ */
:root {
    /* Primary Colors - Deep Indigo/Violet */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* Accent - Teal */
    --accent-400: #2dd4bf;
    --accent-500: #14b8a6;
    --accent-600: #0d9488;

    /* Neutrals - Slate */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --gray-950: #020617;

    /* Semantic Colors */
    --success-50: #f0fdf4;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --info-50: #eff6ff;
    --info-500: #3b82f6;

    /* Layout */
    --sidebar-width: 272px;
    --header-height: 68px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --border-radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);
    --shadow-glow: 0 0 20px rgb(99 102 241 / 0.15);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Lordicon Base Styles ---- */
lord-icon {
    display: inline-flex;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
    overflow-x: hidden;
}

a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-700);
}

img {
    max-width: 100%;
    display: block;
}

/* ============================================================
   3. LAYOUT - APP SHELL
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--gray-900) 0%, var(--gray-950) 100%);
    color: var(--gray-100);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-base);
    overflow-y: auto;
}

.sidebar-brand {
    padding: 24px 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-brand h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary-400) 0%, var(--accent-400) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand span {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: block;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gray-500);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--gray-400);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    color: var(--gray-100);
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    box-shadow: 0 4px 12px rgb(99 102 241 / 0.3);
}

.nav-link .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-link .badge {
    margin-left: auto;
    background: var(--danger-500);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--border-radius-full);
    min-width: 18px;
    text-align: center;
}

/* Sidebar User Info */
.sidebar-user {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-100);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    font-size: 11px;
    color: var(--gray-500);
}

/* ---- MAIN CONTENT AREA ---- */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- HEADER ---- */
.main-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 500;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0; /* Ensures flex container can shrink */
}

.header-left h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-full);
    border: 1px solid var(--gray-200);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--gray-600);
    font-size: 16px;
}

.header-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-800);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: var(--border-radius-full);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-user:hover {
    background: var(--gray-100);
}

.header-user .avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    color: #fff;
}

.header-user span {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

/* ---- MAIN CONTENT ---- */
.main-content {
    flex: 1;
    padding: 28px 32px;
}

/* ============================================================
   4. COMPONENTS
   ============================================================ */

/* ---- Cards ---- */
.card {
    background: #fff;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--gray-200);
    padding: 24px;
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-subtitle {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* ---- Stats Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: #fff;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--gray-200);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: var(--primary-50);
    color: var(--primary-600);
}

.stat-icon.accent {
    background: #f0fdfa;
    color: var(--accent-600);
}

.stat-icon.warning {
    background: var(--warning-50);
    color: var(--warning-600);
}

.stat-icon.success {
    background: var(--success-50);
    color: var(--success-600);
}

.stat-icon.info {
    background: var(--info-50);
    color: var(--info-500);
}

.stat-icon.danger {
    background: var(--danger-50);
    color: var(--danger-500);
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    letter-spacing: -1px;
}

.stat-info p {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
    font-weight: 500;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgb(99 102 241 / 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    box-shadow: 0 4px 16px rgb(99 102 241 / 0.35);
    transform: translateY(-1px);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-500), var(--success-600));
    color: #fff;
}

.btn-success:hover {
    transform: translateY(-1px);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-500), var(--danger-600));
    color: #fff;
}

.btn-danger:hover {
    transform: translateY(-1px);
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--border-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--gray-600);
}

.btn-icon:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.btn-icon-danger:hover {
    background: var(--danger-50);
    border-color: var(--danger-500);
}

/* ---- Form Elements ---- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-800);
    background: #fff;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.12);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--gray-200);
    background: #fff;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.data-table th {
    padding: 12px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
}

.data-table td {
    padding: 12px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive Tables */
@media (max-width: 768px) {
    .table-wrapper {
        border: none;
        background: transparent;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table thead {
        display: none;
    }

    .data-table tr {
        margin-bottom: 16px;
        background: #fff;
        border-radius: var(--border-radius-md);
        border: 1px solid var(--gray-200);
        box-shadow: var(--shadow-sm);
        padding: 8px 0;
    }

    .data-table td {
        padding: 10px 16px;
        border-bottom: 1px solid var(--gray-100);
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 11px;
        text-transform: uppercase;
        color: var(--gray-500);
        margin-right: 16px;
        text-align: left;
    }

    .data-table td:last-child {
        border-bottom: none;
    }
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--border-radius-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: var(--primary-50);
    color: var(--primary-700);
}

.badge-success {
    background: var(--success-50);
    color: var(--success-600);
}

.badge-danger {
    background: var(--danger-50);
    color: var(--danger-600);
}

.badge-warning {
    background: var(--warning-50);
    color: var(--warning-600);
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ---- Avatar ---- */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-full);
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 11px;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 18px;
}

/* ---- Alerts / Flash Messages ---- */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 500;
    animation: alertSlideIn 0.3s ease;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: var(--success-50);
    color: var(--success-600);
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: var(--danger-50);
    color: var(--danger-600);
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--warning-50);
    color: var(--warning-600);
    border: 1px solid #fde68a;
}

.alert-info {
    background: var(--info-50);
    color: var(--info-500);
    border: 1px solid #bfdbfe;
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0;
    line-height: 1;
}

.alert-close:hover {
    opacity: 1;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    color: var(--gray-500);
    max-width: 360px;
    margin: 0 auto 20px;
}

/* ============================================================
   5. LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--primary-900) 50%, var(--gray-950) 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgb(99 102 241 / 0.15), transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgb(45 212 191 / 0.1), transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
}

.login-card {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-xl);
    padding: 48px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgb(0 0 0 / 0.3);
    position: relative;
    z-index: 1;
    animation: loginAppear 0.6s ease;
}

@keyframes loginAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--border-radius-lg);
    background: linear-gradient(135deg, var(--primary-600), var(--accent-500));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: #fff;
    box-shadow: 0 8px 24px rgb(99 102 241 / 0.3);
}

.login-logo h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 6px;
}

.login-form .form-group {
    margin-bottom: 22px;
}

.login-form .form-input {
    padding: 13px 16px;
    font-size: 14.5px;
    border-radius: var(--border-radius-md);
    background: var(--gray-50);
    border-color: var(--gray-200);
}

.login-form .form-input:focus {
    background: #fff;
}

.login-form .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    border-radius: var(--border-radius-md);
}

/* ============================================================
   6. MESSAGING STYLES
   ============================================================ */
.messaging-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    background: #fff;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--gray-200);
    height: calc(100vh - var(--header-height) - 56px);
    overflow: hidden;
}

.conversation-list {
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conversation-list-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conversation-list-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.conversation-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

.conversation-item:hover {
    background: var(--gray-50);
    color: inherit;
}

.conversation-item.active {
    background: var(--primary-50);
    color: inherit;
}

.conversation-item .conv-info {
    flex: 1;
    min-width: 0;
}

.conversation-item .conv-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item .conv-preview {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.conversation-item .conv-time {
    font-size: 11px;
    color: var(--gray-400);
    flex-shrink: 0;
}

/* Chat Area - Dark Theme */
.chat-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--gray-900);
}

.mobile-back-btn {
    display: none;
    /* Hidden on desktop */
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--gray-900);
}

.chat-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
}

.chat-header .member-count {
    font-size: 12px;
    color: var(--gray-400);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--gray-950);
}

.message-bubble {
    display: flex;
    gap: 10px;
    max-width: 70%;
    animation: msgAppear 0.2s ease;
}

@keyframes msgAppear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble.mine {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-bubble .msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-full);
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 10px;
    color: #fff;
    flex-shrink: 0;
}

.message-bubble .msg-content {
    background: var(--gray-800);
    border-radius: 16px 16px 16px 4px;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.3);
}

.message-bubble.mine .msg-content {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: #fff;
    border-radius: 16px 16px 4px 16px;
    border: none;
    box-shadow: 0 2px 8px rgb(99 102 241 / 0.25);
}

.msg-content .msg-sender {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-300);
    margin-bottom: 2px;
}

.message-bubble.mine .msg-sender {
    color: rgb(255 255 255 / 0.75);
}

.msg-content .msg-text {
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    color: var(--gray-200);
}

.msg-content .msg-time {
    font-size: 10px;
    color: var(--gray-500);
    margin-top: 4px;
    text-align: right;
}

.message-bubble.mine .msg-time {
    color: rgb(255 255 255 / 0.6);
}

.msg-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.msg-delete {
    font-size: 16px;
    color: var(--gray-500);
    text-decoration: none;
    opacity: 0;
    transition: all var(--transition-fast);
    line-height: 1;
}

.message-bubble:hover .msg-delete {
    opacity: 1;
}

.msg-delete:hover {
    color: var(--danger-500);
}

/* Dark scrollbar for chat */
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--gray-700);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--gray-600);
}

/* Chat empty state dark theme */
.chat-empty h3 {
    color: var(--gray-400);
}

/* Chat Input */
.chat-input {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--gray-900);
}

.chat-input form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input .form-input {
    flex: 1;
    border-radius: var(--border-radius-full);
    padding: 12px 20px;
    background: var(--gray-800);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--gray-100);
}

.chat-input .form-input::placeholder {
    color: var(--gray-500);
}

.chat-input .btn {
    border-radius: var(--border-radius-full);
    width: 44px;
    height: 44px;
    padding: 0;
}

/* No conversation selected */
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    background: var(--gray-950);
}

.chat-empty .empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ============================================================
   7. DOCUMENTS STYLES
   ============================================================ */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.doc-card {
    background: #fff;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--gray-200);
    padding: 20px;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.doc-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.folder-card-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.folder-actions-float {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.folder-card-wrapper:hover .folder-actions-float {
    opacity: 1;
}

.folder-actions-float .btn-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
    background: #fff;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    color: var(--gray-600);
    text-decoration: none;
}

.folder-actions-float .btn-icon:hover {
    background: var(--gray-50);
    color: var(--primary-600);
}

.folder-actions-float .btn-icon-danger:hover {
    color: var(--danger-600);
    border-color: var(--danger-200);
}

.doc-card .doc-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.doc-icon.pdf {
    background: #fef2f2;
    color: #dc2626;
}

.doc-icon.word {
    background: #eff6ff;
    color: #2563eb;
}

.doc-icon.excel {
    background: #f0fdf4;
    color: #16a34a;
}

.doc-icon.image {
    background: #fdf4ff;
    color: #a855f7;
}

.doc-icon.default {
    background: var(--gray-100);
    color: var(--gray-500);
}

.doc-card .doc-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-card .doc-meta {
    font-size: 12px;
    color: var(--gray-500);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.doc-card .doc-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* Folders */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.folder-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

.folder-card:hover {
    background: var(--primary-50);
    border-color: var(--primary-200);
    color: inherit;
}

.folder-card .folder-icon {
    font-size: 24px;
    color: var(--warning-500);
}

.folder-card .folder-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
}

.folder-card .folder-count {
    font-size: 11px;
    color: var(--gray-500);
}

/* ============================================================
   8. VIDEO STYLES
   ============================================================ */
.video-room-container {
    height: calc(100vh - var(--header-height) - 56px);
    display: flex;
    flex-direction: column;
    background: #000;
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

/* ============================================================
   9. DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item .activity-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-full);
    background: var(--primary-50);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--primary-600);
    flex-shrink: 0;
}

.activity-item .activity-text {
    font-size: 13px;
    color: var(--gray-700);
    flex: 1;
}

.activity-item .activity-text strong {
    font-weight: 600;
    color: var(--gray-900);
}

.activity-item .activity-time {
    font-size: 11px;
    color: var(--gray-400);
    flex-shrink: 0;
}

/* ============================================================
   9. MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    animation: modalAppear 0.25s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-full);
    border: none;
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ============================================================
   10. UPLOAD ZONE
   ============================================================ */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius-md);
    padding: 48px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--gray-50);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-400);
    background: var(--primary-50);
}

.upload-zone .upload-icon {
    font-size: 40px;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.upload-zone h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.upload-zone p {
    font-size: 12px;
    color: var(--gray-500);
}

/* ============================================================
   11. TOOLBAR
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn {
    padding: 7px 16px;
    border-radius: var(--border-radius-full);
    border: 1px solid var(--gray-200);
    background: #fff;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    text-decoration: none;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-50);
    border-color: var(--primary-200);
    color: var(--primary-700);
}

/* ============================================================
   12. CHECKBOX USER SELECT
   ============================================================ */
.user-select-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
}

.user-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-select-item:last-child {
    border-bottom: none;
}

.user-select-item:hover {
    background: var(--gray-50);
}

.user-select-item input[type="checkbox"] {
    accent-color: var(--primary-600);
    width: 16px;
    height: 16px;
}

/* ============================================================
   13. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        /* Slightly wider on mobile for better touch targets */
        box-shadow: var(--shadow-xl);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .main-content {
        padding: 16px 12px;
    }

    .main-header {
        padding: 0 16px;
        height: 60px;
        /* Slimmer header on mobile */
    }

    .header-left h2 {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }

    .header-user span {
        display: none;
        /* Hide user name on small screens, keep just the avatar */
    }

    .header-btn,
    .header-user {
        border: none;
        background: transparent;
        padding: 4px;
        width: 36px;
        height: 36px;
    }

    /* Adjust Dashboard layout */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Cards */
    .card {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .stat-icon {
        margin-bottom: 8px;
    }

    .messaging-layout {
        grid-template-columns: 1fr;
        height: calc(100vh - 60px - 24px);
    }

    /* Default mobile behavior: Show list if no chat selected */
    .conversation-list {
        display: block;
        border-right: none;
        height: 100%;
    }

    .chat-area {
        display: none;
        height: 100%;
    }

    /* If chat is active, hide list and show chat */
    .chat-active .conversation-list {
        display: none;
    }

    .chat-active .chat-area {
        display: flex;
    }

    /* Empty state hidden on mobile when active */
    .chat-active .chat-empty {
        display: none;
    }

    .mobile-back-btn {
        display: flex;
        align-items: center;
        margin-right: 12px;
        color: #fff;
        text-decoration: none;
        font-size: 24px;
        line-height: 1;
    }



    .documents-grid,
    .folders-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 20px;
        margin: 10px;
        width: calc(100% - 20px);
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-input,
    .form-select,
    .form-textarea,
    .btn {
        font-size: 16px;
        /* Prevents iOS auto-zoom on inputs */
    }

    .toolbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .toolbar-left,
    .toolbar-right {
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 1;
        text-align: center;
    }

    .btn {
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
    }

    /* Keep buttons inline in flex rows (action groups) */
    .d-flex > .btn,
    .d-flex > a.btn,
    .doc-actions > .btn,
    .toolbar-right .btn,
    .btn-sm {
        width: auto;
        margin-bottom: 0;
    }
}

/* ---- Very small screens (phones ≤ 480px) ---- */
@media (max-width: 480px) {
    .header-left h2 {
        max-width: 130px;
        font-size: 15px;
    }

    .main-content {
        padding: 12px 8px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        text-align: left;
        padding: 14px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        margin-bottom: 0;
    }

    .stat-info h3 {
        font-size: 22px;
    }

    .card {
        padding: 14px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Login card adjustments */
    .login-card {
        padding: 32px 20px;
        border-radius: var(--border-radius-lg);
    }

    .login-logo h1 {
        font-size: 22px;
    }

    .login-logo .logo-icon {
        width: 52px;
        height: 52px;
        font-size: 24px;
    }

    /* Modal full-width on tiny screens */
    .modal {
        padding: 16px;
        margin: 8px;
        width: calc(100% - 16px);
    }

    .toolbar {
        gap: 8px;
    }

    .data-table td {
        padding: 8px 12px;
        font-size: 13px;
    }

    .login-page {
        padding: 12px;
    }
}

/* ---- Tiny screens (phones ≤ 360px) ---- */
@media (max-width: 360px) {
    .login-card {
        padding: 24px 16px;
    }

    .login-logo h1 {
        font-size: 20px;
    }

    .login-logo .logo-icon {
        width: 48px;
        height: 48px;
    }

    .login-page {
        padding: 8px;
    }

    .main-content {
        padding: 10px 6px;
    }

    .header-left h2 {
        max-width: 100px;
        font-size: 14px;
    }
}

/* ============================================================
   14. SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================================
   15. UTILITY CLASSES
   ============================================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--gray-500);
}

.text-sm {
    font-size: 12px;
}

.text-xs {
    font-size: 11px;
}

.font-bold {
    font-weight: 700;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.flex-wrap {
    flex-wrap: wrap;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}