/* BlueTinker — Public Website & Portal Styles */

:root {
    --chs-primary: #1d4f9c;
    --chs-primary-dark: #123a73;
    --chs-accent: #f08c1a;
    --chs-accent-light: #f5a73a;
    --chs-light: #f8f9fa;
    --chs-text: #2d3748;
    --chs-muted: #718096;
    --chs-white: #ffffff;
    --chs-success: #38a169;
    --font-heading: 'Georgia', 'Times New Roman', serif;
    --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    color: var(--chs-text);
    line-height: 1.6;
    margin: 0;
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-heading);
    color: var(--chs-primary);
    line-height: 1.3;
}

a { color: var(--chs-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--chs-accent); }

/* Top bar */
.top-bar {
    background: var(--chs-primary-dark);
    color: rgba(255,255,255,0.85);
    font-size: 0.85rem;
    padding: 0.4rem 0;
}
.top-bar a { color: rgba(255,255,255,0.9); }
.top-bar a:hover { color: var(--chs-accent-light); }
.top-bar-sep { opacity: 0.5; margin: 0 0.35rem; }
.top-bar-contact,
.top-bar-phones {
    display: flex;
    align-items: center;
}
.top-bar-phones a {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}
.social-links {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.social-links a {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    color: var(--chs-white);
    font-size: 0.95rem;
}
.social-links a:hover {
    background: var(--chs-accent);
    color: var(--chs-primary-dark);
}
.social-links-dark a {
    background: var(--chs-primary);
    color: var(--chs-white);
}
.social-links-dark a:hover {
    background: var(--chs-primary-dark);
    color: var(--chs-white);
}
.footer-social { margin-top: 0.75rem; }

.navbar-chs .navbar-brand {
    display: flex;
    align-items: center;
    margin-right: 1rem;
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
    max-width: none;
}
.navbar-chs {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}
.navbar-chs .navbar-brand .site-logo,
img.site-logo {
    height: 72px !important;
    width: auto !important;
    max-height: 72px !important;
    max-width: 280px !important;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
    background: transparent;
    border-radius: 0;
}
img.site-logo-lg {
    height: 64px !important;
    width: auto !important;
    max-height: 64px !important;
    max-width: 280px !important;
    margin-bottom: 0.75rem;
}
img.site-logo-sidebar {
    height: 88px !important;
    width: auto !important;
    max-height: 88px !important;
    max-width: 280px !important;
}
.brand-logo-link {
    display: block;
    line-height: 0;
}
.portal-sidebar .brand {
    padding: 1rem 1.25rem;
    justify-content: center;
}
.portal-sidebar .brand .portal-sidebar-close {
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
}
.navbar-brand .brand-wordmark { display: none; }

/* Navbar */
.navbar-chs {
    background: var(--chs-white);
    box-shadow: var(--shadow);
    padding: 0.4rem 0;
    min-height: 88px;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.navbar-brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--chs-primary) !important;
}
.navbar-brand span { color: var(--chs-accent); }
.nav-link {
    color: var(--chs-text) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
}
.nav-link:hover, .nav-link.active { color: var(--chs-primary) !important; }
.dropdown-menu { border: none; box-shadow: var(--shadow); border-radius: var(--radius); }
.dropdown-item:hover { background: var(--chs-light); color: var(--chs-primary); }

.btn-staff {
    background: var(--chs-accent);
    color: var(--chs-primary-dark) !important;
    font-weight: 700;
    padding: 0.5rem 1.25rem !important;
    border-radius: var(--radius);
    border: 2px solid var(--chs-accent);
    transition: all 0.2s;
}
.btn-staff:hover {
    background: var(--chs-accent-light);
    border-color: var(--chs-accent-light);
    transform: translateY(-1px);
}

.navbar-chs .navbar-toggler {
    border: 1px solid #cbd5e0;
    padding: 0.4rem 0.55rem;
}
.navbar-chs .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.15);
}
.navbar-chs .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%231a365d' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

@media (max-width: 991.98px) {
    .navbar-chs .navbar-collapse {
        background: var(--chs-white);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        margin-top: 0.75rem;
        padding: 0.75rem;
    }
    .navbar-chs .nav-link {
        padding: 0.75rem 0.85rem !important;
        border-radius: 6px;
    }
    .navbar-chs .btn-staff {
        display: inline-block;
        text-align: center;
        margin-top: 0.35rem;
        width: 100%;
    }
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--chs-primary) 0%, var(--chs-primary-dark) 70%);
    color: var(--chs-white);
    padding: 5rem 0;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0; right: 0;
    height: 60px;
    background: var(--chs-white);
    clip-path: polygon(0 100%, 100% 0, 100% 100%);
}
.hero h1 {
    color: var(--chs-white);
    font-size: 2.75rem;
    margin-bottom: 1rem;
}
.hero .lead { font-size: 1.2rem; opacity: 0.92; max-width: 600px; }
.hero-accent { color: var(--chs-accent-light); }

.btn-primary-chs {
    background: var(--chs-accent);
    border: none;
    color: var(--chs-primary-dark);
    font-weight: 700;
    padding: 0.75rem 2rem;
    border-radius: var(--radius);
}
.btn-primary-chs:hover {
    background: var(--chs-accent-light);
    color: var(--chs-primary-dark);
}
.btn-outline-light-chs {
    border: 2px solid rgba(255,255,255,0.8);
    color: var(--chs-white);
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: var(--radius);
}
.btn-outline-light-chs:hover {
    background: var(--chs-white);
    color: var(--chs-primary);
}

/* Cards & sections */
.section { padding: 4rem 0; }
.section-alt { background: var(--chs-light); }
.section-title {
    text-align: center;
    margin-bottom: 3rem;
}
.section-title h2 { font-size: 2rem; margin-bottom: 0.5rem; }
.section-title .underline {
    width: 60px;
    height: 4px;
    background: var(--chs-accent);
    margin: 0 auto;
}

.feature-card {
    background: var(--chs-white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    height: 100%;
    transition: transform 0.2s;
    border-top: 4px solid var(--chs-accent);
}
.feature-card:hover { transform: translateY(-4px); }
/* Unified icons: white glyph on blue circle */
.chs-icon,
.feature-card .icon,
.nav-icon,
.chs-icon-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--chs-primary);
    color: var(--chs-white) !important;
    border-radius: 50%;
    flex-shrink: 0;
}
.chs-icon,
.feature-card .icon {
    width: 56px;
    height: 56px;
    font-size: 1.35rem;
    margin-bottom: 1rem;
}
.nav-icon {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    margin-right: 0.65rem;
}
.chs-icon-sm {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    margin-right: 0.4rem;
    vertical-align: middle;
}
.chs-icon i,
.feature-card .icon i,
.nav-icon i,
.chs-icon-sm i {
    color: var(--chs-white) !important;
    line-height: 1;
}

.stat-card {
    text-align: center;
    padding: 2rem;
    background: var(--chs-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stat-card .number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--chs-primary);
    font-family: var(--font-heading);
}
.stat-card .label { color: var(--chs-muted); font-size: 0.95rem; }

/* Page header */
.page-header {
    background: linear-gradient(135deg, var(--chs-primary), var(--chs-primary-dark));
    color: var(--chs-white);
    padding: 3rem 0;
    margin-bottom: 0;
}
.page-header h1 { color: var(--chs-white); margin: 0; }
.breadcrumb-chs {
    background: transparent;
    padding: 0;
    margin-top: 0.5rem;
}
.breadcrumb-chs a { color: var(--chs-accent-light); }
.breadcrumb-chs .active { color: rgba(255,255,255,0.7); }

/* Content */
.content-block { padding: 3rem 0; }
.content-block h3 { margin-top: 2rem; }
.content-block ul { padding-left: 1.25rem; }
.content-block li { margin-bottom: 0.5rem; }

.info-box {
    background: var(--chs-light);
    border-left: 4px solid var(--chs-accent);
    padding: 1.5rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 1.5rem 0;
}

/* News cards */
.news-card {
    background: var(--chs-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.news-card .news-body { padding: 1.5rem; }
.news-card .news-date {
    color: var(--chs-accent);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}
.gallery-item {
    margin: 0;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, var(--chs-primary), var(--chs-primary-dark));
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-item figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.65rem 0.85rem;
    background: linear-gradient(transparent, rgba(15, 23, 42, 0.78));
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Contact form */
.contact-form .form-control {
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
}
.contact-form .form-control:focus {
    border-color: var(--chs-primary);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.15);
}

/* Footer */
.footer {
    background: var(--chs-primary-dark);
    color: rgba(255,255,255,0.85);
    padding: 3rem 0 1.5rem;
}
.footer h5 { color: var(--chs-accent-light); margin-bottom: 1rem; }
.footer a { color: rgba(255,255,255,0.8); }
.footer a:hover { color: var(--chs-accent-light); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 2rem;
    padding-top: 1.5rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
}

/* Staff Login */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--chs-light);
}
.login-sidebar {
    flex: 1;
    background: linear-gradient(160deg, var(--chs-primary) 0%, var(--chs-primary-dark) 100%);
    color: var(--chs-white);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.login-sidebar h2 { color: var(--chs-white); font-size: 2rem; }
.login-sidebar ul { list-style: none; padding: 0; margin-top: 2rem; }
.login-sidebar li {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.login-sidebar li::before {
    content: '✓';
    color: var(--chs-accent-light);
    font-weight: bold;
}
.login-form-area {
    flex: 1;
    max-width: 480px;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--chs-white);
}
.login-logo {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--chs-primary);
    margin-bottom: 0.25rem;
}
.login-logo span { color: var(--chs-accent); }
.login-form .form-control {
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
}
.login-form .form-control:focus {
    border-color: var(--chs-primary);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.15);
}
.btn-login {
    background: var(--chs-primary);
    color: var(--chs-white);
    border: none;
    padding: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius);
    width: 100%;
}
.btn-login:hover { background: var(--chs-primary-dark); color: var(--chs-white); }
.login-back { color: var(--chs-muted); font-size: 0.9rem; }

/* Portal Dashboard */
.portal-layout { display: flex; min-height: 100vh; }
.portal-sidebar {
    width: 260px;
    background: var(--chs-primary-dark);
    color: var(--chs-white);
    flex-shrink: 0;
}
.portal-sidebar .brand {
    position: relative;
    padding: 1.1rem 1.25rem;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 110px;
}
.portal-sidebar .brand span { color: var(--chs-accent-light); }
.portal-sidebar .brand-text {
    font-family: var(--font-heading);
    font-size: 1.15rem;
}
.portal-sidebar .brand-text span { color: var(--chs-accent-light); }
.portal-nav { padding: 1rem 0; }
.portal-nav a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.8);
    border-left: 3px solid transparent;
}
.portal-nav a:hover, .portal-nav a.active {
    background: rgba(255,255,255,0.08);
    color: var(--chs-white);
    border-left-color: var(--chs-accent);
}
.portal-main { flex: 1; background: var(--chs-light); }
.portal-header {
    background: var(--chs-white);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 40;
}
.portal-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.portal-header-text {
    min-width: 0;
}
.portal-header-text h5 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55vw;
}
.portal-menu-btn,
.portal-sidebar-close {
    border: 1px solid #e2e8f0;
    background: var(--chs-white);
    color: var(--chs-primary);
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
    cursor: pointer;
}
.portal-sidebar-close {
    border-color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08);
    color: var(--chs-white);
}
.portal-mobile-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}
.portal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 36, 64, 0.45);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.portal-backdrop.is-visible { opacity: 1; }
.portal-mobile-tabs {
    display: none;
    background: var(--chs-white);
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    position: sticky;
    top: 72px;
    z-index: 30;
}
.portal-mobile-tabs a,
.portal-mobile-more {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-width: 68px;
    padding: 0.45rem 0.5rem;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--chs-muted);
    font-size: 0.7rem;
    text-decoration: none;
    cursor: pointer;
}
.portal-mobile-tabs a i,
.portal-mobile-more i {
    font-size: 1.15rem;
    color: var(--chs-primary);
}
.portal-mobile-tabs a.active {
    background: #ebf4ff;
    color: var(--chs-primary);
    font-weight: 600;
}
.portal-content { padding: 2rem; }

@media (max-width: 991px) {
    .login-sidebar { display: none; }
    .login-form-area { max-width: 100%; }
    .hero h1 { font-size: 2rem; }

    .portal-layout { display: block; }
    .portal-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(300px, 86vw);
        z-index: 100;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        overflow-y: auto;
        box-shadow: 8px 0 24px rgba(0,0,0,0.2);
        display: block;
    }
    .portal-sidebar.is-open {
        transform: translateX(0);
    }
    .portal-header {
        padding: 0.75rem 1rem;
    }
    .portal-content {
        padding: 1rem;
    }
    .portal-mobile-tabs {
        display: flex;
    }
    body.portal-menu-open {
        overflow: hidden;
    }
}

.dashboard-stat {
    background: var(--chs-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}
.dashboard-stat .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--chs-primary);
    font-family: var(--font-heading);
}
.attendance-bar {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 0.5rem;
}
.attendance-bar-fill {
    height: 100%;
    background: var(--chs-success);
    border-radius: 6px;
}

@media (max-width: 767px) {
    .hero { padding: 3rem 0; }
    .section { padding: 2.5rem 0; }
    .portal-header-text h5 { font-size: 0.95rem; }
}

@media (max-width: 575.98px) {
    .top-bar {
        padding: 0.55rem 0;
    }
    .top-bar > .container {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    .top-bar-contact {
        width: 100%;
        flex-direction: column;
        gap: 0.3rem;
    }
    .top-bar-contact > .top-bar-sep {
        display: none;
    }
    .top-bar-phones {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.25rem;
        font-size: clamp(0.68rem, 2.9vw, 0.78rem);
    }
    .top-bar-phones .top-bar-sep {
        display: none;
    }
    .top-bar-phones a {
        justify-content: center;
        min-height: 32px;
    }
    .top-bar-phones .bi {
        margin-right: 0.2rem;
    }
    .top-bar-email {
        overflow-wrap: anywhere;
        text-align: center;
    }
    .top-bar .social-links {
        justify-content: center;
    }
}

/* Portal tables & badges */
.portal-table { font-size: 0.9rem; margin-bottom: 0; }
.portal-table thead th {
    background: var(--chs-light);
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: var(--chs-primary);
    white-space: nowrap;
}
.portal-table tbody tr:hover { background: #f7fafc; }

.badge-cbc { background: #ebf8ff; color: #2b6cb0; font-weight: 600; }
.badge-844 { background: #fef3c7; color: #92400e; font-weight: 600; }
.badge-success { background: #c6f6d5; color: #22543d; font-weight: 600; }
.badge-warning { background: #fefcbf; color: #744210; font-weight: 600; }
.badge-danger { background: #fed7d7; color: #742a2a; font-weight: 600; }
.badge-muted { background: #edf2f7; color: #718096; font-weight: 600; }
.badge-gold { background: var(--chs-accent); color: var(--chs-primary-dark); font-weight: 700; }
.badge-role { background: #e9d8fd; color: #553c9a; font-weight: 600; }
.badge-grade { background: var(--chs-primary); color: #fff; font-weight: 700; }
.badge-mpesa { background: #48bb78; color: #fff; font-weight: 600; }
.badge-special { background: #fbb6ce; color: #702459; font-weight: 600; font-size: 0.7rem; }

.mini-stat {
    background: var(--chs-white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    text-align: center;
}
.mini-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--chs-primary);
    font-family: var(--font-heading);
}
.mini-stat-label { color: var(--chs-muted); font-size: 0.85rem; margin-top: 0.25rem; }

.mini-feature {
    background: var(--chs-light);
    border-radius: var(--radius);
    padding: 1rem;
    height: 100%;
}

.portal-nav a { font-size: 0.9rem; }

.portal-logout-form { margin: 0; }
.portal-logout-btn {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    border-left: 3px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
}
.portal-logout-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--chs-white);
    border-left-color: var(--chs-accent);
}

.portal-content .nav-tabs .nav-link {
    color: var(--chs-primary) !important;
    font-weight: 600;
    background: transparent;
}
.portal-content .nav-tabs .nav-link.active {
    background: var(--chs-white);
    border-color: #dee2e6 #dee2e6 var(--chs-white);
}

/* Top bar: white icons on dark blue */
.top-bar .bi {
    color: var(--chs-white);
    margin-right: 0.25rem;
}

/* Password show / hide toggle (eye inside field) */
.password-field {
    position: relative;
    display: block;
}
.password-field .form-control {
    padding-right: 2.75rem;
    height: 48px;
}
.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #6b7280;
    padding: 0;
    margin: 0;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}
.password-toggle:hover,
.password-toggle:focus {
    color: var(--chs-primary);
    outline: none;
}
.password-toggle svg {
    display: block;
    pointer-events: none;
}
