/* EctonEd.Uni — minimal app design */

:root {
    --font: 'DM Sans', system-ui, sans-serif;
    --bg: #f5f5f4;
    --surface: #ffffff;
    --surface-hover: #fafaf9;
    --text: #1c1917;
    --text-secondary: #78716c;
    --text-tertiary: #a8a29e;
    --border: #e7e5e4;
    --border-light: #f5f5f4;
    --accent: #1c1917;
    --accent-soft: #f5f5f4;
    --accent-line: #d6d3d1;
    --highlight: #0d9488;
    --highlight-soft: #ccfbf1;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --success: #059669;
    --success-soft: #ecfdf5;
    --sidebar-w: 240px;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(28, 25, 23, 0.06), 0 8px 24px rgba(28, 25, 23, 0.04);

    --bs-body-font-family: var(--font);
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
    --bs-primary: var(--accent);
    --bs-primary-rgb: 28, 25, 23;
    --bs-border-color: var(--border);
    --bs-border-radius: var(--radius-sm);
    --bs-link-color: var(--highlight);
    --bs-link-hover-color: #0f766e;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.5;
}

/* ═══════════════════════════════════════
   APP SHELL — sidebar layout
   ═══════════════════════════════════════ */
.app-shell {
    overflow-x: hidden;
}

.app-layout {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.875rem;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 1050;
    isolation: isolate;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, 0.35);
    z-index: 1040;
}

.sidebar-backdrop.show {
    display: block;
}

.app-main {
    min-height: 100vh;
    box-sizing: border-box;
}

/* Desktop: offset main content beside fixed sidebar */
@media (min-width: 992px) {
    .app-main {
        margin-left: var(--sidebar-w);
        width: calc(100% - var(--sidebar-w));
    }

    .sidebar-backdrop {
        display: none !important;
    }
}

/* Mobile: sidebar slides in as drawer */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(28, 25, 23, 0.12);
    }

    .app-main {
        width: 100%;
        margin-left: 0;
    }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--text);
    padding: 0.25rem 0.5rem 1.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.sidebar-brand-mark {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: #fff;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.03em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}

.sidebar-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sidebar-link i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.65;
}

.sidebar-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.sidebar-link.active {
    background: var(--accent);
    color: #fff;
}

.sidebar-link.active i { opacity: 1; }

.sidebar-bottom {
    border-top: 1px solid var(--border-light);
    padding-top: 1rem;
    margin-top: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.5rem 0.75rem;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}

.sidebar-user-name {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.sidebar-user-role {
    display: block;
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background 0.12s, color 0.12s;
}

.sidebar-logout:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-topbar-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.app-content {
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.app-footer-inline {
    padding: 1rem 2.5rem 1.5rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

@media (max-width: 991.98px) {
    .app-content { padding: 1.25rem 1rem; }
    .app-footer-inline { padding: 1rem; }
}

/* ═══════════════════════════════════════
   PAGE HERO & LEGACY HEADERS
   ═══════════════════════════════════════ */
.page-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.page-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin: 0 0 0.35rem;
}

.page-hero h1,
.page-header h4 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.15;
    margin: 0;
    color: var(--text);
}

.page-hero h1 { font-size: 2rem; }

.page-lead {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0.5rem 0 0;
    max-width: 420px;
}

.page-header {
    margin-bottom: 1.75rem;
    padding-bottom: 0;
    border-bottom: none;
}

.page-header h4 i { display: none; }

.page-header .text-muted,
.page-header a.small {
    color: var(--text-secondary) !important;
    font-size: 0.8125rem;
}

/* ═══════════════════════════════════════
   METRICS & DASHBOARD GRID
   ═══════════════════════════════════════ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow);
}

.metric {
    background: var(--surface);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--text);
}

.metric--highlight {
    background: var(--highlight-soft);
}

.metric--highlight .metric-value {
    color: var(--highlight);
}

@media (max-width: 767.98px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .page-hero { flex-direction: column; }
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 991.98px) {
    .content-grid { grid-template-columns: 1fr; }
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.panel-head h2 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
}

.panel-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
}

.panel-link:hover {
    color: var(--highlight);
}

.panel-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.panel-empty i {
    font-size: 1.75rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
}

.panel-empty p {
    font-weight: 600;
    margin: 0;
    font-size: 0.9rem;
}

.panel-empty--compact { padding: 2rem 1.25rem; }

.course-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.course-item {
    display: block;
    padding: 0.9rem 1.25rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.12s;
}

.course-item:last-child { border-bottom: none; }

.course-item:hover { background: var(--surface-hover); }

.course-item-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.course-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.course-item-meta {
    display: flex;
    gap: 0.85rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.course-item-meta i { margin-right: 0.15rem; }

/* ═══════════════════════════════════════
   TAGS, STATUS, TABLES
   ═══════════════════════════════════════ */
.tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2em 0.55em;
    background: var(--accent-soft);
    color: var(--text-secondary);
    border-radius: 5px;
    border: 1px solid var(--border);
}

.status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2em 0.55em;
    border-radius: 5px;
}

.status--done {
    background: var(--success-soft);
    color: var(--success);
}

.status--pending {
    background: var(--warning-soft);
    color: var(--warning);
}

.table-wrap { overflow-x: auto; }

.app-table {
    font-size: 0.875rem;
    --bs-table-bg: transparent;
}

.app-table th {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-tertiary);
    background: var(--surface-hover) !important;
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 1.25rem;
    white-space: nowrap;
}

.app-table td {
    padding: 0.85rem 1.25rem;
    border-color: var(--border-light);
    vertical-align: middle;
}

.app-table tbody tr:hover {
    background: var(--surface-hover);
}

.text-secondary { color: var(--text-secondary) !important; }

.fw-medium { font-weight: 500; }

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.btn {
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    padding: 0.55rem 1.1rem;
    transition: all 0.15s;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #292524;
    border-color: #292524;
    color: #fff;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--surface-hover);
    border-color: var(--accent-line);
    color: var(--text);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
}

.btn-outline-primary {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface);
}

.btn-outline-primary:hover {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--text);
}

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

.btn-sm {
    font-size: 0.8125rem;
    padding: 0.4rem 0.8rem;
}

/* ═══════════════════════════════════════
   CARDS & BOOTSTRAP COMPONENTS
   ═══════════════════════════════════════ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 1rem 1.25rem;
}

.card-body { padding: 1.25rem; }

.stat-card {
    border: 1px solid var(--border);
    border-left: none;
}

.stat-card:hover {
    transform: none;
    box-shadow: var(--shadow);
}

.stat-card .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-radius: 8px;
    background: var(--accent-soft);
    opacity: 1;
}

.list-group-item {
    border-color: var(--border-light);
    padding: 0.9rem 1.25rem;
}

.list-group-item:hover { background: var(--surface-hover); }

.badge {
    font-weight: 600;
    font-size: 0.68rem;
    border-radius: 5px;
}

.badge.bg-primary,
.badge.bg-secondary {
    background: var(--accent-soft) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border);
}

.badge.bg-success {
    background: var(--success-soft) !important;
    color: var(--success) !important;
}

.badge.bg-warning {
    background: var(--warning-soft) !important;
    color: var(--warning) !important;
}

.badge.bg-info {
    background: #f0f9ff !important;
    color: #0284c7 !important;
}

.course-badge { font-size: 0.68rem; }

/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */
.form-control,
.form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    background: var(--surface);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px rgba(28, 25, 23, 0.06);
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}

/* ═══════════════════════════════════════
   TABS & ALERTS
   ═══════════════════════════════════════ */
.nav-tabs {
    border-bottom: 1px solid var(--border);
    gap: 0.15rem;
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 0.55rem 1rem;
}

.nav-tabs .nav-link.active {
    color: var(--text);
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-color: var(--surface);
}

.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger  { background: var(--danger-soft); color: var(--danger); }
.alert-info    { background: var(--highlight-soft); color: #0f766e; }

/* ═══════════════════════════════════════
   GUEST / AUTH PAGES
   ═══════════════════════════════════════ */
.guest-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
}

.guest-nav .navbar-brand {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.03em;
}

.guest-brand-mark {
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.guest-main { padding: 2rem 0 3rem; }

.guest-footer {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    padding: 2rem 0;
}

.auth-page {
    background: var(--bg);
    min-height: 100vh;
}

.auth-brand { margin-bottom: 2rem; }

.auth-brand-icon {
    width: 48px;
    height: 48px;
    background: var(--accent);
    color: #fff;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
}

.auth-brand h4 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.auth-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem !important;
    background: var(--surface);
}

.auth-footer {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--highlight);
    font-weight: 600;
    text-decoration: none;
}

/* ═══════════════════════════════════════
   MISC
   ═══════════════════════════════════════ */
.star-rating input { display: none; }
.star-rating label {
    font-size: 1.8rem;
    color: var(--border);
    cursor: pointer;
}
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label { color: #f59e0b; }
.star-rating { display: flex; flex-direction: row-reverse; justify-content: flex-end; }

.file-upload-area {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    background: var(--surface-hover);
    transition: border-color 0.2s, background 0.2s;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--highlight);
    background: var(--highlight-soft);
}

.week-chip {
    display: inline-block;
    padding: 0.2em 0.6em;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.empty-state {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 2rem;
    text-align: center;
}

.text-primary { color: var(--highlight) !important; }

a { color: var(--highlight); }

.table th {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}
