/* Unified Library System UI */

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #0f172a;
    --light-color: #f8fafc;
    --surface-color: #ffffff;
    --surface-muted: #f8fafc;
    --surface-subtle: #f1f5f9;
    --border-color: #e2e8f0;
    --border-strong: #cbd5e1;
    --text-color: #334155;
    --text-strong: #0f172a;
    --muted-color: #64748b;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.14);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 40px;
    --space-6: 48px;
    --transition-fast: 0.2s ease;
    --transition-base: 0.28s ease;
}

html {
    scroll-behavior: smooth;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-color);
    background:
        radial-gradient(circle at top right, rgba(219, 234, 254, 0.9), transparent 32%),
        linear-gradient(180deg, #f8fbff 0%, #f8fafc 100%);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast), opacity var(--transition-fast);
}

a:hover {
    color: var(--secondary-color);
}

button,
input,
select,
textarea {
    font: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    color: var(--text-strong);
    line-height: 1.2;
}

p {
    margin: 0;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background:
        radial-gradient(circle at 12% 12%, rgba(37, 99, 235, 0.25), transparent 36%),
        radial-gradient(circle at 88% 20%, rgba(16, 185, 129, 0.2), transparent 34%),
        linear-gradient(135deg, #dbeafe 0%, #bfdbfe 30%, #e2e8f0 100%);
}

.login-box {
    width: 100%;
    max-width: 440px;
    padding: var(--space-4);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.register-box {
    max-width: 780px;
}

.login-box .logo {
    text-align: center;
    margin-bottom: var(--space-2);
}

.login-box .logo i {
    font-size: 52px;
    color: var(--primary-color);
}

.login-box h2 {
    margin-bottom: var(--space-3);
    text-align: center;
    font-size: clamp(28px, 3vw, 32px);
    font-weight: 700;
}

.auth-meta {
    margin-top: var(--space-2);
    text-align: center;
    font-size: 14px;
    color: var(--muted-color);
}

.auth-page {
    min-height: 100vh;
    padding: 24px;
}

.auth-page.auth-page-blue {
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, #e0ecff 100%);
}

.auth-page.auth-page-green {
    background:
        radial-gradient(circle at top right, rgba(22, 101, 52, 0.22), transparent 28%),
        linear-gradient(135deg, #f6fff8 0%, #d1fae5 40%, #f8fafc 100%);
}

.auth-page.auth-page-dark {
    background:
        radial-gradient(circle at top left, rgba(212, 175, 55, 0.22), transparent 28%),
        linear-gradient(140deg, #0f172a 0%, #1e293b 58%, #111827 100%);
}

.auth-stage {
    min-height: calc(100vh - 48px);
    display: grid;
    place-items: center;
}

.auth-frame {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 480px);
    align-items: stretch;
    gap: 24px;
}

.auth-frame.auth-frame-single {
    grid-template-columns: minmax(0, 720px);
    justify-content: center;
}

.auth-showcase,
.auth-card {
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.auth-showcase {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 620px;
    padding: 40px;
    color: #fff;
}

.auth-showcase.auth-showcase-blue {
    background: linear-gradient(155deg, #1d4ed8 0%, #2563eb 52%, #60a5fa 100%);
}

.auth-showcase.auth-showcase-green {
    background: linear-gradient(155deg, #14532d 0%, #166534 52%, #15803d 100%);
}

.auth-showcase.auth-showcase-dark {
    background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
}

.auth-showcase::before,
.auth-showcase::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.auth-showcase::before {
    width: 260px;
    height: 260px;
    top: -90px;
    right: -70px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
}

.auth-showcase::after {
    width: 300px;
    height: 300px;
    bottom: -150px;
    left: -90px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
}

.auth-showcase > * {
    position: relative;
    z-index: 1;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-showcase-copy h1 {
    margin: 22px 0 16px;
    font-size: clamp(38px, 5vw, 58px);
    line-height: 0.98;
    color: #fff;
}

.auth-showcase-copy p {
    max-width: 56ch;
    color: rgba(255, 255, 255, 0.84);
    font-size: 16px;
    line-height: 1.75;
}

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

.auth-showcase-item {
    padding: 18px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
}

.auth-showcase-item i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 18px;
}

.auth-showcase-item h3 {
    margin-bottom: 8px;
    font-size: 18px;
    color: #fff;
}

.auth-showcase-item p {
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    line-height: 1.65;
}

.auth-card {
    position: relative;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px);
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    pointer-events: none;
}

.auth-card-body {
    position: relative;
    z-index: 1;
    padding: 32px;
}

.auth-card.compact .auth-card-body {
    padding: 36px 32px;
}

.auth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 18px;
    border-radius: 22px;
    color: var(--primary-color);
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.12), rgba(96, 165, 250, 0.24));
}

.auth-icon i {
    display: block;
    line-height: 1;
    text-align: center;
}

.auth-icon.auth-icon-green {
    color: #166534;
    background: linear-gradient(145deg, rgba(22, 101, 52, 0.12), rgba(34, 197, 94, 0.22));
}

.auth-icon.auth-icon-gold {
    color: #b45309;
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.14), rgba(251, 191, 36, 0.24));
}

.auth-card h1,
.auth-card h2 {
    margin-bottom: 8px;
    font-size: clamp(32px, 4vw, 46px);
    line-height: 1.05;
    color: var(--text-strong);
}

.auth-card h2 {
    font-size: clamp(30px, 4vw, 42px);
}

.auth-card-copy {
    margin-bottom: 24px;
    color: var(--muted-color);
    font-size: 15px;
    line-height: 1.75;
}

.auth-form {
    display: grid;
    gap: 2px;
}

.auth-links {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(148, 163, 184, 0.25);
}

.auth-pill-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.auth-pill-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 700;
}

.auth-pill-links a:hover {
    background: rgba(37, 99, 235, 0.14);
}

.auth-inline-link {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.auth-grid,
.layout-grid-2,
.layout-grid-3,
.quick-actions-grid,
.stats-grid,
.chart-grid,
.section-grid,
.books-grid,
.feature-card-grid,
.notification-list,
.chat-mini-list,
.chat-inbox-list {
    display: grid;
    gap: var(--space-2);
}

.auth-grid-2,
.layout-grid-2,
.filters-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-grid-3,
.layout-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-actions-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: var(--space-3);
}

.chart-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    margin-bottom: var(--space-3);
}

.section-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.books-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.feature-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.btn-lg {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 14px;
}

.btn-sm {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 13px;
}

.form-help {
    display: block;
    margin-top: 6px;
    color: var(--muted-color);
    font-size: 12px;
    line-height: 1.5;
}

.mt-15 {
    margin-top: 16px;
}

.mt-20 {
    margin-top: 24px;
}

.mb-0 {
    margin-bottom: 0;
}

.text-muted,
.muted-center {
    color: var(--muted-color);
}

.muted-center {
    text-align: center;
}

.text-warning {
    color: #b45309;
}

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

.results-badge {
    font-size: 14px;
}

/* App layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background:
        radial-gradient(circle at 5% 5%, rgba(255, 255, 255, 0.5), transparent 25%),
        radial-gradient(circle at 95% 0%, rgba(255, 255, 255, 0.35), transparent 22%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    width: 272px;
    color: #f8fafc;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--university-primary, #002B5B) 0%, #0f172a 100%);
    box-shadow: 4px 0 24px rgba(2, 6, 23, 0.2);
    transition: transform var(--transition-base);
}

.sidebar .logo-section {
    padding: 24px 20px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .logo-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.sidebar .nav-menu {
    flex: 1;
    margin: 0;
    padding: 12px 10px 24px;
    list-style: none;
}

.sidebar .nav-menu li + li {
    margin-top: 4px;
}

.sidebar .nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    color: rgba(226, 232, 240, 0.88);
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.sidebar .nav-menu a i {
    width: 20px;
    text-align: center;
}

.sidebar .nav-menu a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(2px);
}

.sidebar .nav-menu a.active {
    background: linear-gradient(90deg, var(--university-secondary, #F2A900), rgba(255, 255, 255, 0.16));
    color: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.24);
}

.menu-badge {
    margin-left: auto;
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    background: #fff;
    color: #0f172a;
}

.sidebar-footer {
    display: grid;
    gap: 12px;
    padding: 18px;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-user-chip {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.sidebar-user-name {
    color: #fff;
    font-weight: 700;
}

.sidebar-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    border-radius: 14px;
    color: #0f172a;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(242, 169, 0, 0.95), rgba(217, 119, 6, 0.95));
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}

.sidebar-logout-btn:hover {
    color: #0f172a;
    transform: translateY(-1px);
}

.main-content {
    flex: 1;
    min-width: 0;
    margin-left: 272px;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 72px;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    backdrop-filter: blur(12px);
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    color: var(--text-strong);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--surface-subtle);
    border-color: var(--border-strong);
}

.top-nav .welcome {
    flex: 1;
    overflow: hidden;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-strong);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-nav .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted-color);
}

.top-nav .logout-btn {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--danger-color);
}

.top-nav .logout-btn:hover {
    color: #fff;
    background: #dc2626;
}

.content-section {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

/* Page title */
.page-header {
    margin-bottom: var(--space-3);
}

.page-header h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: clamp(26px, 2.6vw, 32px);
    font-weight: 700;
}

.page-header p {
    max-width: 72ch;
    font-size: 15px;
    color: var(--muted-color);
}

/* Cards and blocks */
.card,
.panel-box,
.team-box,
.notification-item,
.tool-grid .tool-card,
.support-grid .support-item,
.book-card,
.recent-book-card {
    background: var(--surface-color);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: var(--shadow-sm);
}

.card {
    margin-bottom: var(--space-3);
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 700;
}

.card-body {
    padding: 20px;
}

.panel-box,
.team-box,
.support-grid .support-item,
.tool-grid .tool-card {
    border-radius: var(--radius-md);
    padding: 18px;
}

.panel-box h4,
.tool-grid .tool-card h4,
.support-grid .support-item h4,
.recent-book-card h4,
.notification-item h4 {
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 700;
}

.panel-box ul,
.info-section ul,
.team-box p,
.tool-grid .tool-card p,
.support-grid .support-item p,
.notification-item p,
.book-card p,
.recent-book-card p {
    color: var(--muted-color);
}

.info-section {
    margin-top: 24px;
}

.info-section h3 {
    margin-bottom: 8px;
}

.about-hero {
    padding: 8px 0 18px;
    text-align: center;
}

.about-hero i {
    margin-bottom: 10px;
    font-size: 72px;
    color: var(--primary-color);
}

.about-hero h2 {
    margin-bottom: 6px;
}

.team-box .muted-small {
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted-color);
}

.version-timeline {
    margin-top: 24px;
    padding-left: 16px;
    border-left: 3px solid var(--primary-color);
}

.version-timeline h3 {
    margin-bottom: 12px;
}

.timeline-item + .timeline-item {
    margin-top: 18px;
}

.timeline-item p,
.timeline-item ul {
    margin-top: 8px;
    color: var(--muted-color);
}

.thank-you-banner {
    margin-top: 24px;
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.thank-you-banner i {
    margin-bottom: 8px;
    font-size: 28px;
}

.empty-state {
    padding: 48px 20px;
    text-align: center;
}

.empty-state-icon {
    margin-bottom: 14px;
    font-size: 56px;
    color: #cbd5e1;
}

.empty-state h3 {
    margin-bottom: 8px;
    font-size: 20px;
}

.empty-state p,
.empty-table {
    color: var(--muted-color);
}

.empty-table {
    padding: 32px;
    text-align: center;
}

/* Stats */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border-radius: 16px;
    background: var(--surface-color);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.stat-card .icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-card .details h3 {
    margin-bottom: 4px;
    font-size: 30px;
    line-height: 1;
}

.stat-card .details p {
    font-size: 14px;
    color: var(--muted-color);
}

.stat-card.blue .icon { background: #dbeafe; color: var(--primary-color); }
.stat-card.green .icon { background: #d1fae5; color: var(--success-color); }
.stat-card.yellow .icon { background: #fef3c7; color: #b45309; }
.stat-card.red .icon { background: #fee2e2; color: var(--danger-color); }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.form-group input,
.form-group select,
.form-group textarea,
.search-bar input,
.chat-search-box input {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-strong);
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.form-group textarea,
.messenger-compose textarea {
    min-height: 112px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-bar input:focus,
.chat-search-box input:focus,
.messenger-compose textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[type="file"] {
    padding: 8px 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast),
        background var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    color: #fff;
    background: var(--primary-color);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
    color: #fff;
    background: #1d4ed8;
}

.btn-secondary {
    color: #fff;
    background: #64748b;
}

.btn-secondary:hover {
    color: #fff;
    background: #475569;
}

.btn-success {
    color: #fff;
    background: var(--success-color);
}

.btn-success:hover {
    color: #fff;
    background: #0f9f6e;
}

.btn-warning {
    color: #fff;
    background: var(--warning-color);
}

.btn-warning:hover {
    color: #fff;
    background: #d97706;
}

.btn-danger {
    color: #fff;
    background: var(--danger-color);
}

.btn-danger:hover {
    color: #fff;
    background: #dc2626;
}

/* Search */
.search-bar,
.chat-search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-bar i,
.chat-search-box i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: #94a3b8;
}

.search-bar input,
.chat-search-box input {
    padding-left: 38px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

table thead {
    background: #f8fafc;
}

table th,
table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

table th {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--text-strong);
}

table tbody tr:nth-child(even) {
    background: #fcfdff;
}

table tbody tr:hover {
    background: #f8fbff;
}

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

.info-table th,
.info-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.info-table th {
    width: 220px;
    color: #334155;
    font-weight: 700;
}

.action-buttons {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.action-buttons .btn {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-primary { background: #dbeafe; color: #1e40af; }

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-left: 4px solid transparent;
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
}

.alert a {
    font-weight: 600;
}

.alert-success { background: #ecfdf5; color: #065f46; border-left-color: #10b981; }
.alert-danger { background: #fef2f2; color: #991b1b; border-left-color: #ef4444; }
.alert-warning { background: #fffbeb; color: #92400e; border-left-color: #f59e0b; }
.alert-info { background: #eff6ff; color: #1e40af; border-left-color: #2563eb; }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 6, 23, 0.54);
}

.modal.active {
    display: flex;
}

.modal-content {
    width: min(560px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    font-size: 20px;
}

.close-modal {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #f1f5f9;
    color: #334155;
    font-size: 20px;
    cursor: pointer;
}

.close-modal:hover {
    background: #e2e8f0;
}

/* Reusable blocks */
.quick-action {
    min-height: 84px;
    flex-direction: column;
    text-align: center;
}

.quick-action i {
    font-size: 20px;
}

.quick-action span {
    font-weight: 700;
}

.profile-header {
    margin-bottom: 16px;
    text-align: center;
}

.profile-avatar {
    width: 92px;
    height: 92px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 34px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.profile-header h3 {
    margin-bottom: 2px;
}

.profile-header p {
    color: var(--muted-color);
}

.narrow-form {
    max-width: 520px;
}

.scan-toolbar,
.scan-row,
.card-actions,
.student-utility-links,
.notification-head,
.messenger-thread-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.scan-input {
    max-width: 300px;
}

.qr-reader-wrap,
canvas {
    width: 100%;
}

.book-card,
.recent-book-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-radius: 12px;
    padding: 14px;
}

.book-content {
    flex: 1;
}

.book-title {
    margin: 0 0 8px;
}

.book-desc {
    color: #475569;
}

.book-cover-wrap {
    flex-shrink: 0;
}

.book-cover-thumb {
    width: 52px;
    height: 70px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f8fafc;
    color: #64748b;
}

.book-cover-large {
    width: 95px;
    height: 130px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
}

.book-cover-thumb.placeholder,
.book-cover-large.placeholder {
    font-size: 21px;
}

.featured-card {
    border-left: 4px solid var(--university-secondary, #F2A900);
}

/* Hero blocks */
.feature-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 24px;
    padding: 24px;
    border-radius: 22px;
    color: #fff;
    background:
        radial-gradient(circle at top right, rgba(242, 169, 0, 0.2), transparent 32%),
        linear-gradient(135deg, rgba(0, 43, 91, 0.98), rgba(27, 127, 59, 0.92));
    box-shadow: var(--shadow-lg);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.14);
}

.feature-hero h2 {
    margin-bottom: 10px;
    font-size: clamp(28px, 3vw, 32px);
    color: #fff;
}

.feature-hero p {
    color: rgba(255, 255, 255, 0.82);
}

.feature-card {
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
}

.feature-icon,
.messenger-avatar {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    flex-shrink: 0;
}

.messenger-avatar.large {
    width: 58px;
    height: 58px;
    font-size: 22px;
}

/* Notifications and chat */
.notification-list,
.chat-mini-list,
.chat-inbox-list {
    gap: 12px;
}

.notification-item {
    padding: 14px;
    border-radius: 12px;
}

.notification-item.unread {
    border-left: 4px solid var(--university-secondary, #F2A900);
    background: #fffdf4;
}

.notification-head {
    justify-content: space-between;
}

.chat-thread,
.messenger-thread,
.messenger-conversation-list {
    display: grid;
    gap: 10px;
    overflow-y: auto;
}

.chat-thread {
    max-height: 420px;
    padding: 6px 2px;
}

.messenger-thread {
    max-height: 560px;
    padding-right: 6px;
}

.messenger-conversation-list {
    max-height: 640px;
}

.chat-bubble {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.chat-bubble.mine {
    margin-left: auto;
    background: linear-gradient(120deg, rgba(0, 43, 91, 0.1), rgba(27, 127, 59, 0.12));
    border: 1px solid rgba(0, 43, 91, 0.25);
}

.chat-bubble.theirs {
    margin-right: auto;
    background: #fff;
    border: 1px solid var(--border-color);
}

.chat-meta {
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--muted-color);
}

.chat-text {
    word-break: break-word;
    color: #0f172a;
}

.chat-mini-item {
    display: grid;
    gap: 3px;
    padding: 9px 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
}

.chat-mini-item small {
    color: var(--muted-color);
}

.chat-inbox-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: inherit;
    background: #fff;
}

.chat-inbox-item:hover {
    border-color: var(--university-primary, #002B5B);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.chat-inbox-item.active {
    border-left: 4px solid var(--university-secondary, #F2A900);
    background: #fffdf4;
}

.chat-inbox-meta {
    display: grid;
    justify-items: end;
    gap: 4px;
}

.messenger-layout {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 18px;
}

.messenger-sidebar-card,
.messenger-thread-card {
    overflow: hidden;
}

.messenger-sidebar-header,
.messenger-thread-header {
    align-items: flex-start;
}

.messenger-conversation-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
}

.messenger-conversation-copy {
    min-width: 0;
}

.messenger-conversation-copy small,
.messenger-conversation-copy p {
    display: block;
    margin-top: 4px;
    color: var(--muted-color);
}

.messenger-conversation-copy p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.messenger-compose textarea {
    width: 100%;
    min-height: 112px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #f8fafc;
}

/* Filters and misc layouts */
.filters-grid-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.filters-grid-audit {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: end;
}

.filters-grid-student {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 16px;
}

.inline-form {
    display: inline;
}

.support-grid .support-item,
.tool-grid .tool-card {
    text-align: center;
}

.support-grid .support-item i {
    margin-bottom: 10px;
    font-size: 38px;
}

.tool-grid .tool-card i {
    margin-bottom: 10px;
    font-size: 30px;
}

#qr-reader video {
    border-radius: 10px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 1200px) {
    .filters-grid-main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .content-section {
        padding: 20px;
    }

    .top-nav {
        padding: 14px 20px;
    }

    .auth-frame {
        grid-template-columns: 1fr;
    }

    .auth-frame.auth-frame-single {
        grid-template-columns: minmax(0, 720px);
    }

    .feature-hero,
    .messenger-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .top-nav {
        flex-wrap: wrap;
        gap: 8px;
        min-height: 64px;
    }

    .top-nav .welcome {
        order: 3;
        width: 100%;
        font-size: 14px;
        white-space: normal;
    }

    .top-nav .user-info {
        margin-left: auto;
        gap: 8px;
        font-size: 12px;
    }

    .content-section {
        padding: 16px;
    }

    .auth-page {
        padding: 16px;
    }

    .auth-stage {
        min-height: calc(100vh - 32px);
    }

    .auth-showcase,
    .auth-card-body {
        padding: 24px 20px;
    }

    .auth-showcase {
        min-height: auto;
    }

    .auth-showcase-grid,
    .auth-pill-links {
        grid-template-columns: 1fr;
    }

    .auth-pill-links {
        flex-direction: column;
    }

    .card-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 16px;
    }

    .card-body,
    .panel-box,
    .team-box,
    .support-grid .support-item,
    .tool-grid .tool-card {
        padding: 16px;
    }

    .stats-grid,
    .chart-grid,
    .auth-grid-2,
    .auth-grid-3,
    .layout-grid-2,
    .layout-grid-3,
    .filters-grid-audit,
    .filters-grid-student,
    .filters-grid-two {
        grid-template-columns: 1fr;
    }

    .table-responsive {
        border-radius: 10px;
    }

    table th,
    table td {
        padding: 10px;
        font-size: 12px;
    }

    .book-card,
    .recent-book-card,
    .feature-hero {
        flex-direction: column;
    }

    .feature-hero {
        padding: 20px;
    }

    .feature-hero h2 {
        font-size: 24px;
    }

    .book-cover-large {
        width: 100%;
        max-width: 180px;
        height: auto;
        aspect-ratio: 3 / 4;
    }

    .chat-bubble {
        max-width: 100%;
    }

    .messenger-conversation-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .chat-inbox-meta {
        grid-column: 2;
        justify-self: start;
    }

    .student-utility-links {
        flex-direction: column;
    }

    .sidebar-footer {
        position: sticky;
        bottom: 0;
        background: #0f172a;
    }

    .login-container {
        padding: 20px;
    }

    .login-box {
        padding: 24px 20px;
    }

    body.sidebar-open {
        overflow: hidden;
    }
}
