/* ============================================================
   UniSystem — Crystal Light Theme
   ============================================================ */

:root {
    --uni-primary:       #2563EB;
    --uni-primary-light: #DBEAFE;
    --uni-primary-pale:  #EFF6FF;
    --uni-accent:        #7C3AED;
    --uni-accent-light:  #EDE9FE;
    --uni-teal:          #0891B2;
    --uni-teal-light:    #CFFAFE;
    --uni-green:         #059669;
    --uni-green-light:   #D1FAE5;
    --uni-amber:         #D97706;
    --uni-amber-light:   #FEF3C7;
    --uni-coral:         #DC2626;
    --uni-coral-light:   #FEE2E2;

    --crystal-bg:        #EBF5FB;
    --crystal-surface:   #FFFFFF;
    --crystal-border:    rgba(37, 99, 235, 0.12);
    --crystal-shadow:    0 4px 24px rgba(37, 99, 235, 0.08);
    --crystal-shadow-lg: 0 12px 40px rgba(37, 99, 235, 0.13);

    --text-primary:   #0F172A;
    --text-secondary: #475569;
    --text-muted:     #94A3B8;

    --nav-width:      280px;
    --topbar-height:  64px;
    --radius:         14px;
    --radius-sm:      8px;
}

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

html, body {
    margin: 0; padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #C2DFF4 100%) fixed;
    color: var(--text-primary);
    min-height: 100vh;
}

/* ---- Crystal Glass Card ---- */
.crystal-card {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--crystal-border);
    border-radius: var(--radius);
    box-shadow: var(--crystal-shadow);
    transition: box-shadow 0.25s ease, transform 0.2s ease;
}
.crystal-card:hover {
    box-shadow: var(--crystal-shadow-lg);
    transform: translateY(-2px);
}

/* ---- Sidebar / Nav ---- */
.uni-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--nav-width);
    height: 100vh;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--crystal-border);
    box-shadow: 4px 0 32px rgba(37,99,235,0.06);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1200;
    display: flex;
    flex-direction: column;
}

.uni-sidebar::-webkit-scrollbar { width: 4px; }
.uni-sidebar::-webkit-scrollbar-track { background: transparent; }
.uni-sidebar::-webkit-scrollbar-thumb { background: var(--crystal-border); border-radius: 4px; }

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--crystal-border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--uni-primary), var(--uni-accent));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 20px;
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.sidebar-logo-text { font-size: 15px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.sidebar-logo-sub  { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 14px 4px 14px;
    margin: 0;
}

/* ── Навигационни зони ──────────────────────────────────────── */
.nav-zone {
    margin: 3px 6px;
    border-radius: 10px;
    border-left: 3px solid transparent;
    padding: 2px 0;
}

/* 1. Структура — синьо */
.nav-zone-structure {
    background: rgba(37, 99, 235, 0.055);
    border-left-color: rgba(37, 99, 235, 0.35);
}
.nav-zone-structure .nav-section-label { color: #1d4ed8; }

/* 2. Студенти — зелено */
.nav-zone-students {
    background: rgba(5, 150, 105, 0.055);
    border-left-color: rgba(5, 150, 105, 0.35);
}
.nav-zone-students .nav-section-label { color: #047857; }

/* 3. Преподаватели — кехлибар */
.nav-zone-teachers {
    background: rgba(217, 119, 6, 0.055);
    border-left-color: rgba(217, 119, 6, 0.40);
}
.nav-zone-teachers .nav-section-label { color: #b45309; }

/* 4. Научна дейност — лилаво */
.nav-zone-research {
    background: rgba(124, 58, 237, 0.055);
    border-left-color: rgba(124, 58, 237, 0.35);
}
.nav-zone-research .nav-section-label { color: #6d28d9; }

/* 5. Обучение (програми + LMS) — тюркоаз */
.nav-zone-learning {
    background: rgba(8, 145, 178, 0.055);
    border-left-color: rgba(8, 145, 178, 0.35);
}
.nav-zone-learning .nav-section-label { color: #0369a1; }

/* 6. Администрация — сиво-синьо */
.nav-zone-admin {
    background: rgba(100, 116, 139, 0.055);
    border-left-color: rgba(100, 116, 139, 0.40);
}
.nav-zone-admin .nav-section-label { color: #475569; }

/* 7. Материална база — кафяво-оранжево */
.nav-zone-resources {
    background: rgba(180, 83, 9, 0.05);
    border-left-color: rgba(180, 83, 9, 0.35);
}
.nav-zone-resources .nav-section-label { color: #92400e; }

/* 8. Колегиални & студентски живот — индиго */
.nav-zone-collegiate {
    background: rgba(67, 56, 202, 0.055);
    border-left-color: rgba(67, 56, 202, 0.35);
}
.nav-zone-collegiate .nav-section-label { color: #3730a3; }

/* 9. Персонално — смарагдово зелено */
.nav-zone-personal {
    background: rgba(16, 185, 129, 0.055);
    border-left-color: rgba(16, 185, 129, 0.35);
}
.nav-zone-personal .nav-section-label { color: #065f46; }

/* 10. Система — тъмно */
.nav-zone-system {
    background: rgba(15, 23, 42, 0.045);
    border-left-color: rgba(15, 23, 42, 0.20);
}
.nav-zone-system .nav-section-label { color: #334155; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin: 2px 8px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    position: relative;
}
.nav-item:hover {
    background: var(--uni-primary-light);
    color: var(--uni-primary);
}
.nav-item.active {
    background: var(--uni-primary-light);
    color: var(--uni-primary);
    font-weight: 600;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -8px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--uni-primary);
    border-radius: 0 3px 3px 0;
}
.nav-sub-item {
    padding: 6px 16px 6px 44px;
    font-size: 12.5px;
    font-weight: 400;
}
.nav-sub-item:hover, .nav-sub-item.active {
    font-weight: 500;
}

/* ---- Main Content ---- */
.uni-main {
    margin-left: var(--nav-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Top Bar ---- */
.uni-topbar {
    height: var(--topbar-height);
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--crystal-border);
    position: sticky;
    top: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 16px;
    box-shadow: 0 2px 16px rgba(37,99,235,0.05);
}
.topbar-breadcrumb { flex: 1; font-size: 14px; color: var(--text-secondary); }
.topbar-title { font-weight: 600; font-size: 16px; color: var(--text-primary); }

/* ---- Page Content ---- */
.page-content {
    padding: 6px;
    flex: 1;
}

/* ---- Dashboard Stat Cards ---- */
.stat-card {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--crystal-border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--crystal-shadow);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--stat-color, var(--uni-primary));
    border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--crystal-shadow-lg); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
    background: var(--stat-color-light, var(--uni-primary-light));
}
.stat-value { font-size: 32px; font-weight: 700; color: var(--text-primary); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.stat-change { font-size: 12px; margin-top: 8px; font-weight: 500; }
.stat-change.up   { color: var(--uni-green); }
.stat-change.down { color: var(--uni-coral); }

/* ---- Module Cards (Dashboard) ---- */
.module-card {
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(8px);
    border: 1px solid var(--crystal-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--crystal-shadow);
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.module-card:hover {
    box-shadow: var(--crystal-shadow-lg);
    transform: translateY(-3px);
    border-color: rgba(37,99,235,0.25);
}
.module-card-header { display: flex; align-items: center; gap: 12px; }
.module-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.module-title   { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.module-desc    { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; flex: 1; }
.module-tags    { display: flex; flex-wrap: wrap; gap: 6px; }
.module-tag {
    font-size: 10.5px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
    background: var(--uni-primary-pale);
    color: var(--uni-primary);
}

/* ---- Page Header ---- */
/* ── Акаунт падащо меню ────────────────────────────────────── */
.account-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 10px;
    min-width: 210px;
}

.account-menu-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.account-menu-role {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
}

.account-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 1300;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(15,23,42,0.15);
    border: 1px solid #e2e8f0;
    min-width: 220px;
    padding: 4px 0;
}

.account-menu-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    text-align: left;
    font-family: inherit;
    transition: background 0.1s;
}
.account-menu-item:hover { background: #f1f5f9; }

.account-menu-item-danger { color: #dc2626; }
.account-menu-item-danger:hover { background: #fef2f2; }

.page-header {
    margin-bottom: 28px;
}
.page-header-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-header-sub { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ---- Crystal Table ---- */
.crystal-table {
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--crystal-border);
    border-radius: var(--radius);
    box-shadow: var(--crystal-shadow);
    overflow: hidden;
}

/* ---- Chip/Badge ---- */
.status-chip {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}
.status-active   { background: var(--uni-green-light);  color: var(--uni-green); }
.status-pending  { background: var(--uni-amber-light);  color: var(--uni-amber); }
.status-inactive { background: var(--crystal-border);   color: var(--text-muted); }
.status-error    { background: var(--uni-coral-light);  color: var(--uni-coral); }

/* ---- MudBlazor Overrides for Crystal Theme ---- */
.mud-drawer {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.mud-main-content { background: transparent !important; }
.mud-card {
    border-radius: var(--radius) !important;
    box-shadow: var(--crystal-shadow) !important;
    border: 1px solid var(--crystal-border) !important;
}
.mud-paper {
    border-radius: var(--radius) !important;
    background: linear-gradient(135deg, #ffffff 0%, #daeef8 100%) !important;
}
.mud-table-head .mud-table-cell {
    background: var(--uni-primary-pale) !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--uni-primary) !important;
}
.mud-input-outlined .mud-input-outlined-border {
    border-color: var(--crystal-border) !important;
    border-radius: var(--radius-sm) !important;
}

/* ---- Контроли върху paper — бял фон за контраст ---- */
.mud-input-control,
.mud-input-slot,
.mud-input,
.mud-select-input,
.mud-autocomplete,
.mud-picker input,
.mud-checkbox .mud-button-root,
.mud-switch-track,
.mud-radio .mud-button-root {
    background-color: #ffffff !important;
}
.mud-input-outlined {
    background-color: #ffffff !important;
    border-radius: var(--radius-sm) !important;
}
.mud-button-filled { border-radius: 10px !important; font-weight: 600 !important; }

/* ---- Dialog diagonal gradient ---- */
.mud-dialog {
    background: linear-gradient(135deg, #ffffff 0%, #C2DFF4 100%) !important;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .uni-sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
    .uni-sidebar.open { transform: translateX(0); }
    .uni-main { margin-left: 0; }
    .page-content { padding: 16px; }
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.35s ease both; }
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }

/* ---- Add (+) icon buttons in dialogs ---- */
.btn-add {
    background: #4caf50 !important;
    color: white !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 24px !important;
    min-height: 24px !important;
    padding: 0 !important;
    border-radius: 6px !important;
}
.btn-add .mud-icon-root { font-size: 16px !important; }
.btn-add:hover { background: #388e3c !important; }
