:root {
    --brand: #2f6fb8;
    --brand-light: #3f9ec4;
    --brand-dark: #1f4e85;
    --accent: #16a34a;
    --bg: #f3f6fa;
    --radius: 14px;
    --shadow-sm: 0 2px 8px rgba(20, 30, 60, .06);
    --shadow-md: 0 8px 24px rgba(20, 30, 60, .10);
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    font-family: var(--font-body, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
    margin: 0;
    color: #1f2937;
}

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--brand-dark) 0%, var(--brand) 55%, var(--brand-light) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 2px 0 16px rgba(0,0,0,.08);
}

.sidebar-brand {
    padding: 22px 20px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-user {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    background: rgba(0,0,0,.06);
}
.sidebar-user img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background:#fff; }
.sidebar-user small { display:block; opacity:.75; }

.avatar-fallback {
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; flex-shrink: 0;
}

.sidebar-nav { display: flex; flex-direction: column; padding: 10px 0; flex: 1; overflow-y: auto; }
.sidebar-nav a {
    color: #eaf2fb;
    text-decoration: none;
    padding: 11px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .93rem;
    border-left: 3px solid transparent;
    transition: background .15s ease, border-color .15s ease;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,.10);
}
.sidebar-nav a.active {
    background: rgba(255,255,255,.16);
    color: #fff;
    border-left-color: #fff;
    font-weight: 600;
}

.content { flex: 1; padding: 26px 32px; }

.page-title { font-weight: 800; color: var(--brand-dark); margin-bottom: 4px; letter-spacing: .2px; }
.page-sub { color: #6b7280; margin-bottom: 22px; }

.card-stat {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform .15s ease, box-shadow .15s ease;
}
.card-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.badge-status-Pending { background:#f59e0b; }
.badge-status-Approved, .badge-status-Confirmed, .badge-status-Completed { background:#16a34a; }
.badge-status-Rejected { background:#dc2626; }

.table-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.btn { border-radius: 8px; }
.btn-success { background: var(--accent); border-color: var(--accent); }
.form-control, .form-select { border-radius: 8px; }

/* ===================== Chat (Student <-> HOD/Admin) ===================== */
.chat-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 70vh;
    overflow: hidden;
}

.chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

.chat-empty {
    margin: auto;
    text-align: center;
    color: #9ca3af;
}
.chat-empty i { font-size: 2.2rem; display:block; margin-bottom: 8px; }

.chat-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.4;
    font-size: .92rem;
}
.chat-bubble-me {
    align-self: flex-end;
    background: var(--brand);
    color: #fff;
    border-bottom-right-radius: 3px;
}
.chat-bubble-staff {
    align-self: flex-start;
    background: #eef1f6;
    color: #1f2937;
    border-bottom-left-radius: 3px;
}
.chat-bubble-meta {
    font-size: .72rem;
    opacity: .75;
    margin-top: 4px;
}

.chat-composer {
    border-top: 1px solid #e5e7eb;
    padding: 14px 18px;
    background: #fff;
}
.chat-composer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    gap: 10px;
    flex-wrap: wrap;
}

/* Admin inbox (list + thread) layout */
.chat-inbox {
    display: flex;
    gap: 18px;
    height: 75vh;
}
.chat-inbox-list {
    width: 320px;
    flex-shrink: 0;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px;
    overflow-y: auto;
}
.chat-inbox-search { margin-bottom: 10px; }
.chat-inbox-section-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #9ca3af;
    margin: 10px 4px 6px;
    font-weight: 700;
}
.chat-inbox-empty { color: #9ca3af; font-size: .85rem; padding: 8px; }
.chat-inbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    text-decoration: none;
    color: #1f2937;
    margin-bottom: 4px;
    transition: background .15s ease;
}
.chat-inbox-item .avatar-fallback {
    background: var(--brand);
    color: #fff;
    width: 36px; height: 36px; font-size: .85rem;
}
.chat-inbox-item:hover { background: #f3f6fa; }
.chat-inbox-item.active { background: #e7f0fb; }
.chat-inbox-item-info { display: flex; flex-direction: column; overflow: hidden; }
.chat-inbox-item-info small { color: #6b7280; }

.chat-inbox-thread {
    flex: 1;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-inbox-thread-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
}
.chat-inbox-thread-header .avatar-fallback {
    background: var(--brand);
    color: #fff;
}

@media (max-width: 900px) {
    .chat-inbox { flex-direction: column; height: auto; }
    .chat-inbox-list { width: 100%; max-height: 260px; }
    .chat-inbox-thread { height: 60vh; }
}

@media (max-width: 768px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; }
}
