/* ======================================================
   AISAT College Admin System - Master Stylesheet
   Design: Blue-themed, modern dashboard UI
   Font: Inter (Google Fonts)
====================================================== */

/* --- CSS Variables --- */
:root {
    --primary-blue: #3754DB;
    --primary-dark: #2a3fc7;
    --primary-light: #5a73e8;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #2d2d4a;
    --sidebar-active: rgba(55, 84, 219, 0.2);
    --sidebar-active-border: #3754DB;
    --content-bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --text-white: #ffffff;
    --border-color: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --purple: #8b5cf6;
    --orange: #f97316;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --sidebar-width: 220px;
    --transition: all 0.25s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--content-bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- App Layout --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ======================================================
   SIDEBAR
====================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.logo-placeholder {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
    box-shadow: 0 0 16px rgba(55, 84, 219, 0.4);
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.3px;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.65);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.nav-item:hover {
    color: var(--text-white);
    background: var(--sidebar-hover);
}

.nav-item.active {
    color: var(--text-white);
    background: var(--sidebar-active);
    border-color: var(--sidebar-active-border);
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* ======================================================
   MAIN CONTENT AREA
====================================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 36px;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

/* ======================================================
   STAT CARDS (Dashboard)
====================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-info h3 {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
    display: block;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.blue {
    background: rgba(55, 84, 219, 0.1);
    color: var(--primary-blue);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.orange {
    background: rgba(249, 115, 22, 0.1);
    color: var(--orange);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--purple);
}

/* ======================================================
   CONTENT CARDS
====================================================== */
.content-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ======================================================
   DATA TABLES
====================================================== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    background: var(--content-bg);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.data-table thead th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.data-table thead th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(55, 84, 219, 0.03);
}

.data-table tbody tr.selected-row {
    background: rgba(55, 84, 219, 0.06);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-cell {
    text-align: center;
    color: var(--text-light);
    padding: 32px 16px !important;
    font-style: italic;
}

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ======================================================
   BUTTONS
====================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(55, 84, 219, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(55, 84, 219, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--content-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    background: transparent;
}

.btn-edit {
    color: var(--primary-blue);
}

.btn-edit:hover {
    background: rgba(55, 84, 219, 0.1);
}

.btn-view {
    color: var(--primary-blue);
}

.btn-view:hover {
    background: rgba(55, 84, 219, 0.1);
}

.btn-delete {
    color: var(--danger);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ======================================================
   BADGES
====================================================== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-completed {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-pending {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-missing {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* ======================================================
   FORMS
====================================================== */
.form-group {
    margin-bottom: 16px;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(55, 84, 219, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 12px;
}

/* ======================================================
   SEARCH BAR
====================================================== */
.search-bar {
    margin-bottom: 20px;
}

.search-form {
    position: relative;
    max-width: 400px;
}

.search-form i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 14px;
}

.search-form input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition);
    outline: none;
}

.search-form input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(55, 84, 219, 0.1);
}

/* ======================================================
   FILTER BAR
====================================================== */
.filter-bar {
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.filter-form select {
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    outline: none;
    cursor: pointer;
    min-width: 250px;
    transition: var(--transition);
}

.filter-form select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(55, 84, 219, 0.1);
}

.filter-select {
    flex: 1 1 190px;
    min-width: 190px;
}

.filter-select-wide {
    flex-basis: 240px;
    min-width: 240px;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.filter-actions .btn {
    min-width: 120px;
    justify-content: center;
}

.students-filter-form {
    padding: 14px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.students-filter-select {
    min-width: 190px;
    flex: 1 1 190px;
}

.students-filter-select-wide {
    min-width: 240px;
    flex-basis: 240px;
}

.students-filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.students-filter-actions .btn {
    min-width: 120px;
    justify-content: center;
}

/* ======================================================
   STUDENTS LAYOUT
====================================================== */
.students-layout {
    display: flex;
    gap: 20px;
}

.students-table-card {
    flex: 1;
}

.student-detail-panel {
    width: 320px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 24px;
    align-self: flex-start;
    position: sticky;
    top: 32px;
}

.student-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.student-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4b5563, #374151);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.student-detail-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.student-detail-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.student-detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.student-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.student-meta-item span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.student-meta-item strong {
    font-size: 13px;
    color: var(--text-primary);
}

.student-detail-body h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-pill-connected {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.status-pill-pending {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.status-pill-alert {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.messenger-account-card {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.balance-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.balance-summary-card {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--content-bg);
    border: 1px solid var(--border-color);
}

.balance-summary-card span {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.balance-summary-card strong {
    font-size: 18px;
    font-weight: 700;
}

.balance-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--content-bg);
    border: 1px solid var(--border-color);
}

.balance-ledger-table td:nth-child(4),
.balance-ledger-table td:nth-child(5) {
    font-weight: 700;
    white-space: nowrap;
}

.amount-positive {
    color: #b91c1c;
}

.amount-negative {
    color: #047857;
}

.amount-neutral {
    color: var(--text-primary);
}

.detail-actions {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.inline-action-form {
    width: 100%;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.student-helper-text {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.student-helper-text strong {
    color: var(--text-primary);
}

.mini-table {
    font-size: 12px;
}

.mini-table th {
    padding: 8px 10px !important;
    font-size: 11px !important;
}

.mini-table td {
    padding: 8px 10px !important;
    font-size: 12px !important;
}

/* ======================================================
   MODALS
====================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--content-bg);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* ======================================================
   ANNOUNCEMENTS
====================================================== */
.recent-section {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.recent-section h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 900px) {
    .filter-actions {
        width: 100%;
        margin-left: 0;
    }

    .filter-actions .btn {
        flex: 1 1 160px;
    }

    .students-filter-actions {
        width: 100%;
        margin-left: 0;
    }

    .students-filter-actions .btn {
        flex: 1 1 160px;
    }
}

.section-header-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-header-inline .card-title,
.section-header-inline h2 {
    margin-bottom: 0;
}

.text-link,
.message-count-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-blue);
}

.announcement-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.announcement-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.announcement-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--purple);
    font-size: 16px;
    flex-shrink: 0;
}

.announcement-content h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.announcement-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.announcement-date {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    display: block;
}

/* Announcement Cards (on the announcements page) */
.announcements-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.announcement-card {
    padding: 18px 0;
    border-bottom: 1px solid var(--border-color);
}

.announcement-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.announcement-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.announcement-card-header h4 {
    font-size: 15px;
    font-weight: 600;
}

.announcement-meta {
    font-size: 11px;
    color: var(--text-light);
    display: block;
    margin-top: 2px;
}

.announcement-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.announcement-form .form-actions {
    justify-content: flex-start;
}

.attachment-input {
    display: none;
}

.attachment-picker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1.5px dashed rgba(55, 84, 219, 0.35);
    border-radius: var(--radius-sm);
    background: rgba(55, 84, 219, 0.04);
    color: var(--primary-blue);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.attachment-picker:hover {
    background: rgba(55, 84, 219, 0.08);
    border-color: var(--primary-blue);
}

.announcement-attachment-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.announcement-selected-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.announcement-selected-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(55, 84, 219, 0.16);
    background: #f7f9ff;
}

.announcement-selected-preview {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(55, 84, 219, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.announcement-selected-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.announcement-selected-icon {
    color: var(--primary-blue);
    font-size: 18px;
}

.announcement-selected-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.announcement-selected-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.announcement-selected-size {
    font-size: 11px;
    color: var(--text-secondary);
}

.announcement-selected-remove {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.announcement-selected-remove:hover {
    background: rgba(239, 68, 68, 0.2);
}

.announcement-file-pill,
.announcement-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(55, 84, 219, 0.08);
    color: var(--primary-blue);
    font-size: 12px;
    font-weight: 600;
}

.announcement-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.announcement-image-thumb {
    display: block;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #f8f9fc;
    min-height: 120px;
}

.announcement-image-thumb img {
    width: 100%;
    height: 100%;
    min-height: 120px;
    object-fit: cover;
    display: block;
}

.announcement-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.announcement-file-chip {
    text-decoration: none;
}

/* Empty message */
.empty-message {
    color: var(--text-light);
    font-style: italic;
    padding: 16px 0;
    font-size: 13px;
}

/* Flash message */
.flash-message {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.flash-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.flash-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ======================================================
   LOGIN PAGE
====================================================== */
.login-body {
    background: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), #6366f1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
    box-shadow: 0 4px 20px rgba(55, 84, 219, 0.35);
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: -0.3px;
}

.login-error {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form .form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.login-form .form-group input {
    padding: 13px 18px;
    border-radius: 25px;
    background: var(--primary-blue);
    border: 2px solid transparent;
    color: white;
    font-size: 13.5px;
}

.login-form .form-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.login-form .form-group input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(90, 115, 232, 0.2);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
    box-shadow: 0 4px 15px rgba(55, 84, 219, 0.3);
}

.login-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 20px rgba(55, 84, 219, 0.4);
    transform: translateY(-1px);
}

/* ======================================================
   MESSAGES
====================================================== */
.messages-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.message-scope-tabs {
    display: inline-flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}

.message-scope-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.message-scope-tab:hover {
    color: var(--text-primary);
    background: rgba(55, 84, 219, 0.06);
}

.message-scope-tab.active {
    background: linear-gradient(135deg, var(--primary-blue), #5a73e8);
    color: white;
    box-shadow: 0 4px 12px rgba(55, 84, 219, 0.25);
}

.conversations-panel,
.message-panel {
    margin-bottom: 0;
}

.messages-search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    width: min(100%, 460px);
}

.messages-search-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    outline: none;
    transition: var(--transition);
}

.messages-search-form input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(55, 84, 219, 0.1);
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.conversation-link {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    background: #fbfbfd;
}

.conversation-link:hover,
.conversation-link.active {
    border-color: rgba(55, 84, 219, 0.35);
    background: rgba(55, 84, 219, 0.05);
    box-shadow: var(--shadow-sm);
}

.conversation-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.conversation-name {
    display: inline-block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-right: 8px;
}

.role-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(55, 84, 219, 0.1);
    color: var(--primary-blue);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.conversation-badge {
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--primary-blue);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.conversation-snippet {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.5;
}

.conversation-meta {
    font-size: 11px;
    color: var(--text-light);
}

.conversation-context {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.role-pill-group {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.message-panel-header {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 18px;
}

.message-panel-header h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.message-panel-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.message-thread {
    min-height: 420px;
    max-height: 620px;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 18px;
}

.message-row {
    display: flex;
    margin-bottom: 14px;
}

.message-row.incoming {
    justify-content: flex-start;
}

.message-row.outgoing {
    justify-content: flex-end;
}

.message-bubble {
    max-width: min(78%, 620px);
    border-radius: 18px;
    padding: 14px 16px 12px;
    box-shadow: var(--shadow-sm);
}

.message-bubble.incoming {
    background: #f7f8fc;
    border: 1px solid var(--border-color);
}

.message-bubble.outgoing {
    background: linear-gradient(135deg, var(--primary-blue), #5a73e8);
    color: white;
}

.message-bubble p {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 8px;
    word-break: break-word;
}

.message-time {
    display: block;
    font-size: 10.5px;
    opacity: 0.8;
}

.message-compose {
    border-top: 1px solid var(--border-color);
    padding-top: 18px;
}

.group-thread-item {
    margin-bottom: 14px;
}

.group-thread-item.outgoing {
    text-align: right;
}

.group-thread-item.incoming {
    text-align: left;
}

.group-thread-sender {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding: 0 4px;
}

.group-notification-row {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.group-notification-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(26, 58, 92, 0.08);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-style: italic;
}

.messages-empty-state {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
}

.messages-empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ======================================================
   AUTO REPLIES
====================================================== */
.auto-reply-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.auto-reply-summary-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auto-reply-summary-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auto-reply-summary-card strong {
    font-size: 28px;
    line-height: 1.1;
}

.auto-reply-summary-card p {
    font-size: 12px;
    color: var(--text-secondary);
}

.auto-reply-layout {
    display: grid;
    gap: 20px;
}

.auto-reply-guide-card {
    margin-bottom: 0;
}

.auto-reply-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.auto-reply-guide-item {
    display: flex;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: #fafbff;
}

.auto-reply-guide-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(55, 84, 219, 0.12);
    color: var(--primary-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.auto-reply-guide-item h4 {
    font-size: 14px;
    margin-bottom: 6px;
}

.auto-reply-guide-item p,
.auto-reply-note,
.form-hint,
.auto-reply-readonly {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.auto-reply-note {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(55, 84, 219, 0.05);
    border: 1px solid rgba(55, 84, 219, 0.12);
}

.auto-reply-table td {
    vertical-align: top;
}

.auto-reply-keywords-cell,
.auto-reply-preview-cell {
    max-width: 260px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.role-pill-scope {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.auto-reply-checkbox {
    margin-bottom: 8px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-transform: none;
    letter-spacing: 0;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

/* ======================================================
   ACADEMIC STRUCTURE MODULES
====================================================== */
.academic-summary-grid {
    margin-bottom: 24px;
}

.academic-summary-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.04));
    border: 1px solid rgba(59, 130, 246, 0.12);
}

.academic-table-title {
    font-weight: 600;
    color: var(--text-primary);
}

.academic-table-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ======================================================
   RESPONSIVE
====================================================== */
@media (max-width: 1024px) {
    .dashboard-grid,
    .messages-layout {
        grid-template-columns: 1fr;
    }

    .students-layout {
        flex-direction: column;
    }

    .student-detail-panel {
        width: 100%;
        position: static;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 200px;
    }

    .main-content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
    }

    .messages-search-form {
        width: 100%;
    }

    .message-scope-tabs {
        display: flex;
        width: 100%;
    }

    .message-scope-tab {
        flex: 1 1 0;
        justify-content: center;
    }

    .message-thread {
        min-height: 320px;
    }
}
