/* ============================================================
   SNHSS School Portal - Custom Styles
   Color Palette:
   - Primary:    #1A3C6E (Deep Blue)
   - Secondary:  #2E86AB (Steel Blue)
   - Accent:     #17A2B8 (Teal)
   - Warning:    #F39C12 (Orange)
   - Success:    #27AE60 (Green)
   - Danger:     #E74C3C (Red)
   - Light BG:   #F0F4F8
   - Sidebar BG: #0F2440
   ============================================================ */

:root {
    --primary: #1A3C6E;
    --primary-dark: #0F2440;
    --primary-light: #2E5A9B;
    --secondary: #2E86AB;
    --accent: #17A2B8;
    --warning: #F39C12;
    --success: #27AE60;
    --danger: #E74C3C;
    --light-bg: #F0F4F8;
    --sidebar-bg: #0F2440;
    --sidebar-hover: #1A3C6E;
    --sidebar-active: #2E5A9B;
    --card-shadow: 0 2px 10px rgba(0,0,0,0.08);
    --transition: all 0.3s ease;
}

/* ---------- GLOBAL ---------- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: #333;
    min-height: 100vh;
}

a { color: var(--secondary); text-decoration: none; }
a:hover { color: var(--primary); }

/* ---------- LOGIN PAGE ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--secondary) 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    padding: 30px 30px 25px;
    text-align: center;
    color: #fff;
}

.login-header img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #fff;
    padding: 5px;
    margin-bottom: 12px;
    object-fit: contain;
}

.login-header h4 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
    letter-spacing: 0.5px;
}

.login-header p {
    font-size: 12px;
    margin: 0;
    opacity: 0.8;
}

.login-body {
    padding: 30px;
}

.login-body .form-control {
    border-radius: 8px;
    padding: 10px 15px;
    border: 1.5px solid #dce3eb;
    font-size: 14px;
    transition: var(--transition);
}

.login-body .form-control:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(46,134,171,0.15);
}

.login-body .input-group-text {
    background: var(--light-bg);
    border: 1.5px solid #dce3eb;
    border-radius: 8px 0 0 8px;
    color: var(--primary);
}

.captcha-box {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 12px 15px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 3px;
    user-select: none;
    border: 1.5px dashed #ccd5e0;
    position: relative;
}

.captcha-refresh {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--secondary);
    font-size: 16px;
}
.captcha-refresh:hover {
    color: var(--primary);
}

.btn-login {
    background: var(--primary);
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    width: 100%;
    color: #fff;
    transition: var(--transition);
}

.btn-login:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(26,60,110,0.3);
    color: #fff;
}

/* ---------- LAYOUT: SIDEBAR + CONTENT ---------- */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: #c8d6e5;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 60px;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 16px 18px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-brand img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    padding: 3px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    margin-left: 12px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand .brand-text h5 {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.3;
}

.sidebar-brand .brand-text small {
    font-size: 10px;
    opacity: 0.6;
}

.sidebar.collapsed .brand-text { display: none; }

/* Sidebar Menu */
.sidebar-menu {
    padding: 12px 0;
    list-style: none;
    margin: 0;
}

.sidebar-menu .menu-header {
    padding: 10px 20px 5px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.3);
    font-weight: 600;
}

.sidebar.collapsed .menu-header { display: none; }

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: #c8d6e5;
    font-size: 13.5px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--accent);
}

.sidebar-menu a.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--warning);
}

.sidebar-menu a i {
    width: 22px;
    text-align: center;
    margin-right: 12px;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-menu a span { display: none; }
.sidebar.collapsed .sidebar-menu a i { margin-right: 0; }
.sidebar.collapsed .sidebar-menu a { justify-content: center; padding: 12px; }

/* Submenu */
.sidebar-menu .submenu {
    list-style: none;
    padding: 0;
    background: rgba(0,0,0,0.15);
    display: none;
}

.sidebar-menu .submenu.show { display: block; }

.sidebar-menu .submenu a {
    padding: 8px 20px 8px 54px;
    font-size: 12.5px;
}

.sidebar-menu .has-submenu > a::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    transition: var(--transition);
}

.sidebar-menu .has-submenu.open > a::after {
    transform: rotate(180deg);
}

/* Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
}

/* Top Navbar */
.top-navbar {
    background: #fff;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 999;
}

.top-navbar .navbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--primary);
    cursor: pointer;
    padding: 5px;
}

.top-navbar .page-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

.top-navbar .navbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.top-navbar .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.top-navbar .user-info .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.top-navbar .user-info .user-details {
    line-height: 1.2;
}

.top-navbar .user-info .user-details .name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.top-navbar .user-info .user-details .role {
    font-size: 11px;
    color: #888;
}

/* Page Content */
.page-content {
    padding: 24px;
}

/* ---------- CARDS ---------- */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    overflow: visible;
    position: relative;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.card .card-body {
    overflow: visible;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eef2f7;
    border-radius: 12px 12px 0 0 !important;
    padding: 16px 20px;
    font-weight: 600;
    color: var(--primary);
}

/* ---------- DASHBOARD STAT CARDS ---------- */
.stat-card {
    border-radius: 12px;
    padding: 22px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}

.stat-card .stat-icon {
    font-size: 32px;
    opacity: 0.8;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 2px;
}

.stat-card.bg-primary-custom { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.stat-card.bg-success-custom { background: linear-gradient(135deg, #1e8449, var(--success)); }
.stat-card.bg-warning-custom { background: linear-gradient(135deg, #d68910, var(--warning)); }
.stat-card.bg-danger-custom  { background: linear-gradient(135deg, #c0392b, var(--danger)); }
.stat-card.bg-info-custom    { background: linear-gradient(135deg, #1a8a9e, var(--accent)); }
.stat-card.bg-secondary-custom { background: linear-gradient(135deg, #1d6e8a, var(--secondary)); }

/* ---------- TABLES ---------- */
.table thead th {
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 15px;
    border: none;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 15px;
    font-size: 13px;
    vertical-align: middle;
    border-color: #eef2f7;
}

.table tbody tr:hover {
    background: #f5f8fc;
}

/* ---------- BUTTONS ---------- */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

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

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

/* ---------- BADGES ---------- */
.badge-active {
    background: #d4edda;
    color: #155724;
}

.badge-inactive {
    background: #f8d7da;
    color: #721c24;
}

/* ---------- FORMS ---------- */
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}

.form-control, .form-select {
    font-size: 13.5px;
    border-radius: 8px;
    border: 1.5px solid #dce3eb;
    padding: 8px 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(46,134,171,0.12);
}

/* ---------- ALERTS ---------- */
.alert {
    border-radius: 10px;
    font-size: 13.5px;
    border: none;
    padding: 12px 18px;
}

/* ---------- BREADCRUMB ---------- */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 15px;
    font-size: 13px;
}

.breadcrumb-item a {
    color: var(--secondary);
}

.breadcrumb-item.active {
    color: #888;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.mobile-show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
    }
}

@media (max-width: 576px) {
    .login-card { margin: 10px; }
    .login-header { padding: 20px; }
    .login-body { padding: 20px; }
    .page-content { padding: 15px; }
}

/* ---------- UTILITIES ---------- */
.text-primary-custom { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }
.bg-light-custom { background: var(--light-bg) !important; }

/* Scrollbar for sidebar */
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent; }
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.35); }

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Print styles */
@media print {
    .sidebar, .top-navbar { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
}
