/* ==========================================================================
   SCHOOL ERP OPERATING SYSTEM - Psychology-Grounded Light Mode UI/UX Theme
   Features: Landing Page Auth Portal, PWA Download Banner & Multi-Role Support
   ========================================================================== */

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

:root {
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    
    --border-color: #e2e8f0;
    --border-highlight: #c7d2fe;
    
    --primary: #4338ca;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    
    --accent-blue: #2563eb;
    --accent-emerald: #059669;
    --accent-amber: #d97706;
    --accent-rose: #e11d48;
    --accent-purple: #7c3aed;
    --accent-teal: #0d9488;
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #94a3b8;
    
    --shadow-subtle: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-glow: 0 4px 14px rgba(79, 70, 229, 0.2);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --sidebar-width: 260px;
    --bottom-nav-height: 65px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Background Ambient Glows */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ambient-glow-1 {
    position: absolute;
    top: -10%;
    right: -5%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
    filter: blur(80px);
}

/* LANDING PAGE / LOGIN PORTAL */
.landing-container {
    position: relative;
    z-index: 10;
    max-width: 1150px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.landing-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.landing-badge {
    background: #e0e7ff;
    color: var(--primary);
    padding: 0.35rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.landing-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

.landing-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 650px;
    line-height: 1.6;
}

/* Demo Credentials Grid */
.demo-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.demo-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-subtle);
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
}

.demo-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 14px 30px -5px rgba(79, 70, 229, 0.15);
}

.demo-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.role-icon-box {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.demo-role-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.demo-role-user {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}

.demo-credentials-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.85rem;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.login-btn-quick {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.85rem;
    font-weight: 700;
}

/* APP HEADER BAR */
.app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.pwa-install-btn {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    transition: transform 0.2s ease;
}

.pwa-install-btn:hover {
    transform: scale(1.03);
}

/* APP LAYOUT */
#app-container {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.layout-wrapper {
    display: flex;
    width: 100%;
    height: calc(100vh - 50px);
    margin-top: 50px;
    overflow: hidden;
}

/* Sidebar Navigation (Desktop) */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: white;
    box-shadow: var(--shadow-glow);
}

.brand-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Navigation Links */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-item.active a, .nav-item a:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    font-weight: 700;
}

.nav-icon {
    font-size: 1.1rem;
    width: 24px;
    display: inline-block;
    text-align: center;
}

.user-profile-sidebar {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #4338ca, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
}

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

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.user-role-tag {
    font-size: 0.72rem;
    color: var(--accent-blue);
    font-weight: 600;
}

/* Main Content Workspace */
.main-content {
    flex: 1;
    background: var(--bg-primary);
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Dashboard Page Headers */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.page-subtext {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Parent Child Switcher */
.child-switcher-container {
    background: #ffffff;
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-subtle);
}

.child-switcher-select {
    background: transparent;
    color: var(--primary);
    border: none;
    font-size: 1rem;
    font-weight: 800;
    outline: none;
    cursor: pointer;
}

/* Psychology KPI Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-subtle);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.icon-purple { background: rgba(124, 58, 237, 0.1); color: var(--accent-purple); }
.icon-cyan { background: rgba(13, 148, 136, 0.1); color: var(--accent-teal); }
.icon-emerald { background: rgba(5, 150, 105, 0.1); color: var(--accent-emerald); }
.icon-amber { background: rgba(217, 119, 6, 0.1); color: var(--accent-amber); }
.icon-rose { background: rgba(225, 29, 72, 0.1); color: var(--accent-rose); }

.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-footer {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

.trend-up { color: var(--accent-emerald); font-weight: 700; }
.trend-down { color: var(--accent-rose); font-weight: 700; }

/* Admissions Kanban Pipeline */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-top: 0.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 480px;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.column-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.column-count {
    background: #ffffff;
    color: var(--text-muted);
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--border-color);
}

.kanban-cards-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kanban-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
}

.applicant-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.applicant-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-sm {
    padding: 0.32rem 0.7rem;
    font-size: 0.78rem;
}

.btn-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 540px;
    padding: 1.75rem;
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}

.form-input, .form-select {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--bottom-nav-height);
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
}

.mobile-nav-item.active {
    color: var(--primary);
    font-weight: 800;
}

.mobile-nav-icon {
    font-size: 1.2rem;
}

@media (max-width: 868px) {
    .sidebar {
        display: none;
    }
    .mobile-bottom-nav {
        display: flex;
    }
    .main-content {
        padding: 1.25rem;
        padding-bottom: 80px;
    }
    .landing-title {
        font-size: 1.8rem;
    }
    .demo-cards-grid {
        grid-template-columns: 1fr;
    }
}
