/* EducaHt Redesign - 2026 */

@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
    --brand-900: #082a5a;
    --brand-800: #0b3b7d;
    --brand-700: #0b4b9a;
    --brand-600: #155fd6;
    --brand-500: #1f7ae0;
    --brand-300: #93c5fd;
    --brand-100: #e7f0ff;

    --ink-900: #0c1320;
    --ink-800: #1a2533;
    --ink-700: #2a3647;
    --ink-600: #475569;
    --ink-500: #64748b;
    --ink-300: #cbd5e1;
    --ink-200: #e2e8f0;
    --ink-100: #f1f5f9;
    --ink-50: #f8fafc;

    --success-600: #15803d;
    --warning-600: #b45309;
    --danger-600: #b91c1c;

    --shadow-sm: 0 4px 12px rgba(10, 20, 40, 0.08);
    --shadow-md: 0 12px 30px rgba(10, 20, 40, 0.14);
    --shadow-lg: 0 20px 50px rgba(10, 20, 40, 0.2);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --space-2xs: 4px;
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    --font-body: "Source Sans 3", "Segoe UI", Arial, sans-serif;
    --font-display: "Space Grotesk", "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    color: var(--ink-800);
    background: var(--ink-50);
}

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

a {
    color: var(--brand-600);
    text-decoration: none;
}

a:hover {
    color: var(--brand-700);
}

.text-muted {
    color: #2a3647 !important;  /* Darker color for WCAG AA compliance */
}

.container-narrow {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-wide {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* Buttons */
.btn,
button.btn {
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    font-family: var(--font-body);
}

.btn-primary {
    background: linear-gradient(120deg, var(--brand-600), var(--brand-700));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    border-color: var(--ink-200);
    color: var(--ink-700);
}

.btn-ghost {
    background: transparent;
    color: var(--brand-700);
    border-color: transparent;
}

.btn-outline {
    background: transparent;
    border-color: var(--brand-600);
    color: var(--brand-700);
}

.btn-outline:hover {
    background: var(--brand-100);
}

/* Cards */
.card {
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: white;
}

.card-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--ink-200);
    background: var(--ink-50);
    font-weight: 600;
}

.card-body {
    padding: var(--space-lg);
}

/* Forms */
.form-control,
select.form-control,
textarea.form-control {
    border-radius: 10px;
    border: 1px solid var(--ink-200);
    padding: 10px 12px;
}

.form-control:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(31, 122, 224, 0.15);
}

label {
    font-weight: 600;
    color: var(--ink-700);
}

.table {
    border-color: var(--ink-200);
}

.table thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-500);
}

.table tbody tr {
    background: white;
}

.table tbody tr:hover {
    background: var(--ink-50);
}

.badge {
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 600;
}

.badge-success { background: rgba(21, 128, 61, 0.15); color: var(--success-600); }
.badge-warning { background: rgba(180, 83, 9, 0.15); color: var(--warning-600); }
.badge-danger { background: rgba(185, 28, 28, 0.15); color: var(--danger-600); }

/* App Shell */
.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    background: var(--ink-50);
}

.app-shell.sidebar-collapsed {
    grid-template-columns: 90px 1fr;
}

.app-sidebar {
    background: linear-gradient(180deg, var(--brand-900), #0a2145);
    color: white;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    overflow: hidden;
}

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

.app-topbar {
    background: white;
    border-bottom: 1px solid var(--ink-200);
    padding: var(--space-md) var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-content {
    padding: var(--space-xl);
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.page-title {
    font-family: var(--font-display);
    font-size: 28px;
    margin: 0;
}

.page-subtitle {
    color: var(--ink-500);
    margin-top: var(--space-2xs);
}

/* Sidebar */
.brand-lockup {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.brand-lockup img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: white;
    padding: 6px;
}

.brand-lockup .brand-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.nav-section {
    margin-top: var(--space-md);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
}

.nav-section .collapse {
    padding-left: 4px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
    margin: var(--space-sm) 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.85);
    transition: background 0.15s ease, transform 0.15s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
}

.nav-item i {
    width: 18px;
    text-align: center;
}

.nav-section-header,
.nav-section-subheader {
    width: 100%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: background 0.15s ease;
}

.nav-section-header:hover,
.nav-section-subheader:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: var(--space-sm) 0;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sidebar-user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: white;
}

.profile-pic {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    border-radius: 999px;
    padding: 6px 10px;
}

.app-sidebar.collapsed {
    width: 90px;
    padding: var(--space-md);
}

.app-sidebar.collapsed .brand-name,
.app-sidebar.collapsed .nav-section-title,
.app-sidebar.collapsed .nav-item span,
.app-sidebar.collapsed .nav-section-header span,
.app-sidebar.collapsed .nav-section-subheader span,
.app-sidebar.collapsed .sidebar-user-details {
    display: none;
}

.app-sidebar.collapsed .nav-item {
    justify-content: center;
}

/* Topbar */
.topbar-title {
    font-family: var(--font-display);
    font-size: 18px;
}

.topbar,
.topbar-right,
.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.topbar {
    background: white;
    border-bottom: 1px solid var(--ink-200);
    padding: var(--space-md) var(--space-xl);
    justify-content: space-between;
}

.breadcrumb {
    margin: 0;
    font-size: 13px;
    color: var(--ink-500);
}

.search-box {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--ink-100);
    border-radius: 999px;
    padding: 6px 12px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 200px;
}

.notification-bell {
    position: relative;
}

.notification-bell .badge {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 10px;
    padding: 2px 6px;
    background: var(--danger-600);
    color: white;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--ink-200);
}

.topbar-search {
    background: var(--ink-100);
    border-radius: 999px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    border: 1px solid transparent;
}

.topbar-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 240px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--ink-200);
    display: grid;
    place-items: center;
    background: white;
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.stat-card {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    background: white;
    border: 1px solid var(--ink-200);
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-500);
}

.stat-value {
    font-size: 26px;
    font-family: var(--font-display);
    margin-top: var(--space-xs);
}

/* Gateway (public landing) */
.gateway {
    background: radial-gradient(circle at top, #f0f6ff 0%, #ffffff 50%, #f9fafb 100%);
    min-height: 100vh;
    color: var(--ink-800);
}

.gateway-hero {
    padding: 80px 0 60px;
}

.gateway-hero h1 {
    font-family: var(--font-display);
    font-size: 46px;
    margin-bottom: var(--space-md);
}

.gateway-hero p {
    font-size: 18px;
    color: var(--ink-600);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
}

.feature-card {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    background: white;
    border: 1px solid var(--ink-200);
    box-shadow: var(--shadow-sm);
}

/* Login */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top, #eef5ff, #ffffff 60%);
    padding: var(--space-xl);
}

.auth-card {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1fr);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    width: min(1100px, 100%);
}

/* Legacy login classes (override) */
body.login-page {
    font-family: var(--font-body);
    background: radial-gradient(circle at top, #eef5ff, #ffffff 60%);
}

.login-container {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--ink-200);
}

.login-brand-panel {
    background: linear-gradient(150deg, var(--brand-900), var(--brand-700));
}

.login-brand-logo i {
    display: none;
}

.login-brand-logo::before {
    content: "";
    width: 40px;
    height: 40px;
    background: url("/assets/brand/educaht-logo-white.png") center/contain no-repeat;
    display: inline-block;
}

.login-brand-title,
.login-brand-tagline,
.login-brand-subtitle,
.login-feature-title,
.login-feature-desc,
.login-brand-cta-text {
    color: rgba(255, 255, 255, 0.9);
}

.login-form-title {
    font-family: var(--font-display);
}

.login-submit-btn {
    background: linear-gradient(120deg, var(--brand-600), var(--brand-700));
    border-radius: 999px;
}

.login-submit-btn:hover {
    box-shadow: var(--shadow-md);
}

.auth-brand {
    background: linear-gradient(150deg, var(--brand-900), var(--brand-700));
    color: white;
    padding: var(--space-2xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.auth-form {
    padding: var(--space-2xl);
}

.auth-title {
    font-family: var(--font-display);
    font-size: 28px;
}

@media (max-width: 992px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 260px;
        height: 100vh;
        transition: left 0.2s ease;
        z-index: 40;
    }

    .app-sidebar.show {
        left: 0;
    }

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

    .topbar-search input {
        width: 140px;
    }
}

/* Module access */
.module-access-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.module-access-layout {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    gap: var(--space-lg);
    align-items: start;
}

.module-access-roles .card {
    position: sticky;
    top: 92px;
}

.role-list-scroll {
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    padding-right: 4px;
}

.role-hint {
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px dashed var(--ink-200);
}

.role-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.role-pill {
    border: 1px solid var(--ink-200);
    background: white;
    color: var(--ink-700);
    padding: 10px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    transition: border 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.role-pill:hover {
    border-color: var(--brand-300);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.role-pill.is-active {
    border-color: var(--brand-500);
    background: var(--brand-100);
    color: var(--brand-800);
}

.role-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--ink-300);
}

.role-pill.is-active .role-dot {
    background: var(--brand-600);
}

.role-panel {
    display: none;
}

.role-panel.is-active {
    display: block;
}

.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.module-title {
    font-weight: 700;
    font-size: 16px;
}

.module-subtitle {
    color: var(--ink-500);
    font-size: 13px;
}

.module-actions {
    display: flex;
    gap: var(--space-sm);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.module-group {
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    background: var(--ink-50);
}

.module-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.module-group-title {
    font-weight: 700;
    color: var(--ink-700);
}

.module-group-actions {
    display: flex;
    gap: var(--space-xs);
}

.perm-name {
    font-weight: 600;
}

.perm-key {
    font-size: 11px;
    color: var(--ink-500);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ink-200);
    transition: 0.2s;
    border-radius: 999px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: white;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.switch input:checked + .switch-slider {
    background: var(--brand-600);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(20px);
}

.module-access-footer {
    position: sticky;
    bottom: 12px;
    z-index: 5;
}

.module-access-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.module-access-footer-actions {
    display: flex;
    gap: var(--space-sm);
}

@media (max-width: 992px) {
    .module-access-layout {
        grid-template-columns: 1fr;
    }

    .module-access-roles .card {
        position: static;
    }
}

/* Notifications */
.notification-menu {
    min-width: 320px;
    max-width: 420px;
    padding: 8px 0;
}

.notification-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    white-space: normal;
}

.notification-item.unread {
    background: var(--brand-100);
}

.notification-title {
    font-weight: 600;
}

.notification-message {
    font-size: 12px;
    color: var(--ink-600);
}

.notification-time {
    font-size: 11px;
    color: var(--ink-500);
}

.notification-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.offline-status-badge {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--ink-200);
    background: var(--ink-100);
    color: var(--ink-700);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.offline-status-badge.show {
    display: inline-flex;
}

.offline-status-badge.status-offline {
    background: rgba(185, 28, 28, 0.12);
    border-color: rgba(185, 28, 28, 0.4);
    color: var(--danger-600);
}

.offline-status-badge.status-pending {
    background: rgba(180, 83, 9, 0.12);
    border-color: rgba(180, 83, 9, 0.4);
    color: var(--warning-600);
}
