@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@500;600;700;800&family=DM+Sans:wght@400;500;600;700;800&display=swap');

/* ============================================================
   Dire Dawa Schools Portal - Stylesheet  (Design v2)
   Palette inspired by modern school-SaaS dashboards, built
   as our own theme (not copied) — deep indigo + electric blue
   gradient, soft shadows, and small motion for a premium feel.
   ============================================================ */

:root {
    --ink:        #0A1F44;
    --ink-2:      #123069;
    --navy:       #0D2557;
    --navy-2:     #163B7A;
    --accent:     #FFB606;
    --accent-2:   #C98A00;
    --accent-soft: #FFF6E0;
    --bg:         #F5F7FB;
    --card:       #FFFFFF;
    --surface:    #FFFFFF;
    --input-bg:   #FBFCFF;
    --border:     #E4E9F5;
    --text:       #1B2138;
    --text-mute:  #6B7390;
    --success:    #17A673;
    --success-bg: #E6F8F1;
    --warning:    #C7860B;
    --warning-bg: #FFF6E0;
    --danger:     #E5484D;
    --danger-bg:  #FDECEC;
    --radius:     14px;
    --radius-sm:  9px;
    --shadow:     0 6px 22px rgba(10, 31, 68, 0.09);
    --shadow-lg:  0 16px 40px rgba(10, 31, 68, 0.2);
}

* { box-sizing: border-box; }

body {
    font-family: "DM Sans", "Segoe UI", Arial, Helvetica, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-2); text-decoration: none; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
    0%   { background-position: -300px 0; }
    100% { background-position: 300px 0; }
}

/* ---------- Header ---------- */
.site-header {
    background: linear-gradient(120deg, var(--ink) 0%, var(--navy-2) 100%);
    color: #E9ECF9;
    padding: 16px 25px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 18px rgba(15, 19, 40, 0.35);
}
.header-inner {
    max-width: 1140px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.brand {
    color: #fff;
    font-size: 19px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: .2px;
}
.brand:hover { color: #fff; }
.brand-icon {
    font-size: 22px;
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 4px 14px rgba(255, 182, 6, .45);
}
.main-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.main-nav a {
    color: #C6CCE6;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background .15s ease, color .15s ease;
}
.main-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---------- Layout ---------- */
.page-content { max-width: 1140px; margin: 0 auto; padding: 34px 20px 60px; min-height: 60vh; }
.site-footer {
    text-align: center; padding: 22px; font-size: 13px; color: var(--text-mute);
    background: var(--surface); border-top: 1px solid var(--border);
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 54px 20px 40px; animation: fadeInUp .5s ease both; }
.hero-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 74px; height: 74px; border-radius: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; font-size: 34px; margin-bottom: 22px;
    box-shadow: 0 12px 30px rgba(255, 182, 6, .35);
}
.hero h1 { font-size: 38px; margin: 8px 0; font-weight: 800; letter-spacing: -.5px; }
.hero p { color: var(--text-mute); max-width: 600px; margin: 12px auto 26px; font-size: 15.5px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; border: none;
    padding: 12px 26px; font-size: 15px; font-weight: 600;
    border-radius: 10px; cursor: pointer;
    box-shadow: 0 6px 18px rgba(255, 182, 6, .3);
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(255, 182, 6, .4); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-outline {
    background: var(--surface); color: var(--accent); border: 1.5px solid var(--accent-soft);
    box-shadow: none;
}
.btn-outline:hover { background: var(--accent-soft); color: var(--accent-2); transform: translateY(-1px); box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.btn-full { width: 100%; padding: 14px; text-align: center; }

/* ---------- Card ---------- */
.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 26px 30px; margin-bottom: 26px;
    border: 1px solid var(--border);
    animation: fadeInUp .4s ease both;
}
.card h2 { margin-top: 0; }
.card-title-bar {
    margin: -26px -30px 22px -30px;
    background: linear-gradient(120deg, var(--ink), var(--navy-2));
    color: #fff; padding: 18px 30px;
    border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
}
.card-title-bar h2 { margin: 0; }
.form-narrow { max-width: 480px; margin: 0 auto; }

/* ---------- Forms ---------- */
label { font-weight: 700; font-size: 13.5px; color: var(--text); }
input[type="text"], input[type="password"], input[type="number"], select {
    width: 100%; padding: 10px 12px; margin-top: 5px; margin-bottom: 16px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 15px; background: var(--input-bg);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 182, 6, .15); background: var(--surface);
}
.field { margin-bottom: 4px; }
.help-text { font-size: 13px; color: var(--text-mute); margin-top: -10px; margin-bottom: 16px; }

/* ---------- Alerts ---------- */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; animation: fadeInUp .3s ease both; }
.alert-error   { background: var(--danger-bg);  color: #A5222A; border: 1px solid #F4C6C8; }
.alert-success { background: var(--success-bg); color: #0F7A54; border: 1px solid #B9E9D4; }
.alert-info    { background: var(--accent-soft); color: #8A6008; border: 1px solid #FFE6A6; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- List items ---------- */
.list-item {
    display: block; background: var(--card); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 12px;
    border: 1px solid var(--border);
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
    animation: fadeInUp .4s ease both;
}
.list-item:hover { box-shadow: var(--shadow-lg); text-decoration: none; transform: translateY(-3px); border-color: #FFE6A6; }
.list-item h3 { margin: 0 0 5px 0; color: var(--text); }
.list-item p { margin: 0; color: var(--text-mute); font-size: 14px; }

.badge {
    display: inline-block; background: var(--accent-soft); color: #8A6008;
    font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; margin-right: 6px;
}
/* Role badges (match the staff-role pill style used across the system) */
.role-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; color: #fff; }
.role-superadmin { background: linear-gradient(135deg,#D9A94E,#B9821F); }
.role-admin      { background: linear-gradient(135deg,#4F7CFF,#3357D6); }
.role-subadmin   { background: linear-gradient(135deg,#28C7C7,#1B9B9B); }
.role-teacher    { background: linear-gradient(135deg,#8B5CF6,#6D3FDB); }
.role-librarian  { background: linear-gradient(135deg,#EC4899,#C22C74); }
.role-parent     { background: linear-gradient(135deg,#22C55E,#159A47); }
.role-student    { background: linear-gradient(135deg,#F59E0B,#C6790A); }
.role-staff      { background: linear-gradient(135deg,#64748B,#454F63); }

/* ---------- Stat boxes ---------- */
.stat-box {
    background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow);
    padding: 20px; text-align: center; border: 1px solid var(--border);
    transition: transform .18s ease, box-shadow .18s ease;
}
.stat-box:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-box .stat-value { font-size: 27px; font-weight: 800; color: var(--accent); }
.stat-box .stat-label { font-size: 13px; color: var(--text-mute); margin-top: 2px; }

/* ---------- Tables ---------- */
table.data-table { width: 100%; border-collapse: collapse; margin-top: 10px; background: var(--card); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); }
table.data-table th, table.data-table td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: center; font-size: 14px; }
table.data-table th { background: var(--ink); color: #E9ECF9; font-weight: 700; }
table.data-table tbody tr { transition: background .12s ease; }
table.data-table tbody tr:hover { background: var(--accent-soft); }
table.data-table td.subject-name { text-align: left; font-weight: 700; }

/* ---------- Tags ---------- */
.tag { display: inline-block; padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.tag-promoted { background: var(--success-bg); color: #0F7A54; }
.tag-detained { background: var(--danger-bg); color: #A5222A; }
.tag-waiting  { background: var(--warning-bg); color: #8A6008; }
.tag-blocked  { background: var(--danger-bg); color: #A5222A; }
.tag-active   { background: var(--success-bg); color: #0F7A54; }
.tag-pending  { background: var(--warning-bg); color: #8A6008; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: 14px; margin-bottom: 20px; color: var(--text-mute); }

/* ---------- Print ---------- */
@media print {
    .site-header, .site-footer, .no-print { display: none !important; }
    body { background: var(--surface); }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ============================================================
   Scroll-reveal, welcome hero & premium controls (shared add-on)
   ============================================================ */

@keyframes welcomeIn {
    from { opacity: 0; transform: translateY(-16px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes welcomeGlow {
    0%, 100% { box-shadow: 0 10px 30px rgba(255, 182, 6, .28); }
    50%      { box-shadow: 0 14px 42px rgba(255, 182, 6, .45); }
}

.welcome-hero {
    text-align: center;
    padding: 46px 24px 40px;
    animation: welcomeIn .7s cubic-bezier(.16,.8,.24,1) both;
}
.welcome-hero .welcome-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 72px; height: 72px; border-radius: 20px; font-size: 32px; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    margin-bottom: 18px;
    animation: welcomeGlow 3.2s ease-in-out infinite;
}
.welcome-hero h1 {
    font-size: 32px; font-weight: 800; margin: 6px 0; letter-spacing: -.4px;
}
.welcome-hero p {
    color: var(--text-mute); max-width: 560px; margin: 8px auto 0; font-size: 15px;
}

/* Scroll-reveal: elements start hidden/offset, then fade+rise into place
   the moment they scroll into view (see main.js for the trigger). */
.reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity .6s cubic-bezier(.16,.8,.24,1), transform .6s cubic-bezier(.16,.8,.24,1);
}
.reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Feature cards used on dashboards to show "what this site consists of" */
.feature-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius, 14px);
    padding: 22px 22px 20px;
    box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    display: block;
}
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg, 0 16px 40px rgba(23,30,56,.16));
    border-color: var(--accent);
    text-decoration: none;
}
.feature-card .feature-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; border-radius: 12px; font-size: 22px; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    margin-bottom: 14px;
}
.feature-card h3 { margin: 0 0 6px; font-size: 16px; }
.feature-card p { margin: 0; color: var(--text-mute); font-size: 13.5px; line-height: 1.5; }

/* ---------- Beautiful <select> dropdowns ---------- */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7390' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px !important;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
select:hover {
    border-color: var(--accent);
}
select:focus {
    transform: translateY(-1px);
}

/* ---------- Staggered list reveal (classmates/news/results lists etc.) ---------- */
.stagger-list .list-item,
.stagger-list .feature-card {
    opacity: 0;
    animation: fadeInUp .5s cubic-bezier(.16,.8,.24,1) forwards;
}
.stagger-list .list-item:nth-child(1),  .stagger-list .feature-card:nth-child(1)  { animation-delay: .03s; }
.stagger-list .list-item:nth-child(2),  .stagger-list .feature-card:nth-child(2)  { animation-delay: .08s; }
.stagger-list .list-item:nth-child(3),  .stagger-list .feature-card:nth-child(3)  { animation-delay: .13s; }
.stagger-list .list-item:nth-child(4),  .stagger-list .feature-card:nth-child(4)  { animation-delay: .18s; }
.stagger-list .list-item:nth-child(5),  .stagger-list .feature-card:nth-child(5)  { animation-delay: .23s; }
.stagger-list .list-item:nth-child(6),  .stagger-list .feature-card:nth-child(6)  { animation-delay: .28s; }
.stagger-list .list-item:nth-child(7),  .stagger-list .feature-card:nth-child(7)  { animation-delay: .33s; }
.stagger-list .list-item:nth-child(8),  .stagger-list .feature-card:nth-child(8)  { animation-delay: .38s; }

@media (prefers-reduced-motion: reduce) {
    .reveal, .welcome-hero, .welcome-icon, .stagger-list .list-item, .stagger-list .feature-card {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}


/* ============================================================
   Dark mode (data-theme="dark" on <html>) — "black and blue"
   ============================================================ */
[data-theme="dark"] {
    --bg:         #F5F7FB;
    --card:       #151B30;
    --border:     #232B48;
    --text:       #E8ECF7;
    --text-mute:  #9AA3C7;
    --success-bg: #123324;
    --warning-bg: #332A0E;
    --danger-bg:  #3A1518;
    --accent-soft: #FFF6E0;
}
[data-theme="dark"] .site-header { box-shadow: 0 2px 18px rgba(0,0,0,.5); }
[data-theme="dark"] .site-footer { background: #0E1426; border-top-color: #232B48; }
[data-theme="dark"] table.data-table tbody tr:hover { background: rgba(255,255,255,.04); }
[data-theme="dark"] .stat-box:hover, [data-theme="dark"] .feature-card:hover, [data-theme="dark"] .list-item:hover {
    box-shadow: 0 16px 38px rgba(0,0,0,.45);
}

/* ---------- Theme toggle switch ---------- */
.theme-toggle {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    background: var(--accent-soft); border: 1px solid var(--border);
    color: var(--accent); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600;
    transition: background .15s ease, transform .15s ease;
}
.theme-toggle:hover { transform: translateY(-1px); }

/* Toggle sits on the always-dark gradient site-header, so it needs
   its own light-on-dark styling regardless of the active theme. */
.site-header .theme-toggle {
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.25);
    color: #fff;
}
.site-header .theme-toggle:hover { background: rgba(255,255,255,.24); }

/* SVG icon sizing (coded icons, no images/emoji) */
.theme-toggle-icon svg { width: 17px; height: 17px; display: block; }
.feature-icon svg, .welcome-icon svg { display: block; }
.brand-icon svg { width: 60%; height: 60%; }


/* ============================================================
   DDU-inspired refresh — navy & gold identity, added motion
   ============================================================ */

h1, h2, h3, .hero h1, .welcome-hero h1, .card-title-bar h2,
.sidebar-brand, .brand, .login-card h1, .topbar h1 {
    font-family: "Roboto Slab", Georgia, serif;
    letter-spacing: -.2px;
}

/* Page settle-in */
body { animation: pageFade .45s ease both; }
@keyframes pageFade { from { opacity: 0; } to { opacity: 1; } }

/* Animated brand mark */
.sidebar-brand .brand-icon, .brand-icon, .hero-icon, .welcome-hero .welcome-icon, .login-icon {
    position: relative; overflow: hidden;
}
.sidebar-brand .brand-icon::after, .brand-icon::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%);
    background-size: 200% 100%; animation: brandSheen 4.5s ease-in-out infinite;
}
@keyframes brandSheen { 0% { background-position: 200% 0; } 60%, 100% { background-position: -60% 0; } }

/* Gold underline sweep for nav links */
.sidebar-nav a, .main-nav a { position: relative; }
.main-nav a::after {
    content: ""; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px;
    background: var(--accent); border-radius: 2px; transform: scaleX(0); transform-origin: left;
    transition: transform .25s cubic-bezier(.16,.8,.24,1);
}
.main-nav a:hover::after { transform: scaleX(1); }

/* Slow gradient drift on dark surfaces for a living, premium feel */
.sidebar, .site-header, .login-wrap, .card-title-bar {
    background-size: 160% 160%;
    animation: gradientDrift 14s ease-in-out infinite;
}
@keyframes gradientDrift { 0%, 100% { background-position: 0% 0%; } 50% { background-position: 100% 60%; } }

/* Buttons: soft shine sweep on hover, on top of existing lift effect */
.btn { position: relative; overflow: hidden; }
.btn::before {
    content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,.55), transparent);
    transform: skewX(-20deg); transition: left .55s ease;
}
.btn:hover::before { left: 130%; }

/* Cards: gentle golden edge glow on hover for a premium touch */
.card, .feature-card, .stat-box, .list-item {
    transition: transform .25s cubic-bezier(.16,.8,.24,1), box-shadow .25s ease, border-color .25s ease;
}
.card:hover, .feature-card:hover, .stat-box:hover { border-color: rgba(255,182,6,.45); }

/* Smooth theme + color transitions everywhere */
body, .sidebar, .site-header, .card, .btn, .topbar, table.data-table th {
    transition: background-color .35s ease, color .35s ease, border-color .35s ease;
}

/* Custom scrollbar in the university's colors */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--accent), var(--accent-2)); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-2); }

/* Accessible, visible gold focus ring for keyboard users */
a:focus-visible, .btn:focus-visible, .sidebar-nav a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(255,182,6,.55); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    body, .sidebar, .site-header, .login-wrap, .card-title-bar,
    .sidebar-brand .brand-icon::after, .brand-icon::after, .btn::before {
        animation: none !important; transition: none !important;
    }
}
