@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.08);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-soft: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-lg: 16px;
    --glass: rgba(255, 255, 255, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
}

/* =========================
   LOGIN PAGE (NEW – SAFE)
========================= */
.login-page {
    height: 100vh;
    background: #000;
    overflow: hidden;
    position: relative;
}

.login-wrapper {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 10;
}

/* LEFT LOGIN PANEL */
.login-panel {
    width: 35%;
    min-width: 400px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.login-panel::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: url('../images/logo_bg.png') no-repeat center center;
    background-size: contain;
    opacity: 0.08;
    z-index: -1;
    pointer-events: none;
}

.login-panel>* {
    position: relative;
    z-index: 1;
}


.login-panel h1 {
    color: #0b1f3a;
    font-size: 32px;
    margin-bottom: 6px;
}

.login-subtitle {
    color: #666;
    margin-bottom: 40px;
}

.login-panel label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

.login-panel input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.login-panel button {
    background: linear-gradient(135deg, #0b1f3a, #123b7a);
    color: #fff;
    padding: 12px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
}

.login-panel button:hover {
    background: linear-gradient(135deg, #123b7a, #1b4fa3);
}

.error {
    margin-top: 15px;
    color: #c62828;
}

.forgot {
    margin-top: 30px;
    font-size: 13px;
    color: #777;
}

/* RIGHT BRAND PANEL */
.brand-panel {
    flex: 1;
    position: relative;
    color: #ffffff;
    display: flex;
    align-items: center;
    padding: 60px;
    background: rgba(11, 31, 58, 0.4);
    /* Subtle tint */
}

/* BACKGROUND SLIDER (GLOBAL) */
.bg-slider {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.5s ease-in-out, transform 8s linear;
}

.slide.active {
    opacity: 1;
    transform: scale(1.1);
}

.slider-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 70% 50%,
            rgba(11, 31, 58, 0.3) 0%,
            rgba(11, 31, 58, 0.7) 100%);
    z-index: 5;
}

.brand-content {
    position: relative;
    z-index: 10;
    max-width: 520px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}


.brand-content h2 {
    font-size: 36px;
    margin-bottom: 20px;
}

.brand-content p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.features div {
    font-size: 15px;
    margin-bottom: 10px;
}

/* =========================
   APP LAYOUT (DASHBOARD)
========================= */
.app {
    display: flex;
    min-height: 100vh;
}

/* Page Entry Animation */
.content {
    animation: contentReveal 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes contentReveal {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
    width: 280px;
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
}

.logo {
    padding: 35px 25px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.logo span {
    display: block;
    font-size: 10px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-top: 4px;
}

/* MENU */
.menu {
    flex: 1;
    padding: 20px 15px;
    overflow-y: auto;
}

.menu::-webkit-scrollbar {
    width: 4px;
}

.menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.menu a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu a i {
    font-style: normal;
    margin-right: 12px;
    font-size: 16px;
    opacity: 0.8;
    width: 20px;
    display: inline-flex;
    justify-content: center;
}

.menu a:hover i,
.menu a.active i {
    opacity: 1;
}

.menu a.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.menu-title {
    padding: 20px 16px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 700;
}

/* SIDEBAR FOOTER */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #ef4444;
    color: #fff;
}

/* =========================
   CONTENT AREA
========================= */
.content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* TOP BAR */
.topbar {
    height: 80px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar h1 {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.3px;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.user-info strong {
    color: var(--primary);
    font-weight: 800;
}

/* =========================
   CARDS & PANELS
========================= */
.cards {
    padding: 30px 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.card h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.card p {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.card.accent {
    background: linear-gradient(135deg, #fff 0%, #fff1f2 100%);
    border-left: 4px solid var(--danger);
}

/* DASHBOARD PANELS */
.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    padding: 0 40px 40px;
}

.panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.panel h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.panel ul {
    list-style: none;
}

.panel li {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel li:last-child {
    border-bottom: none;
}

.panel li small {
    color: var(--text-muted);
    font-size: 12px;
}

/* =========================
   TABLES & FORMS
========================= */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
}

.data-table th {
    background: #f8fafc;
    padding: 14px 20px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-main);
}

.data-table tr:hover td {
    background: #f1f5f9;
}

.form-panel {
    max-width: 600px;
    background: var(--bg-card);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* =========================
   BUTTONS & STATUS
========================= */
.primary-btn {
    background: var(--accent);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.primary-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.link-btn {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
}

.link-btn:hover {
    text-decoration: underline;
}

.danger-text {
    color: var(--danger);
    font-weight: 600;
}

.status-active {
    background: #ecfdf5;
    color: #10b981;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.status-inactive {
    background: #fef2f2;
    color: #ef4444;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

/* =========================
   UNIVERSITY DASHBOARD WIDGETS
========================= */
.dashboard-header {
    padding: 40px 40px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.dashboard-header h2 {
    font-size: 32px;
    font-weight: 950;
    color: var(--primary);
    letter-spacing: -1.2px;
    margin: 0;
}

.user-info {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 5px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    padding: 0 40px 30px;
}

.action-card {
    background: #fff;
    padding: 24px 20px;
    border-radius: var(--radius);
    text-align: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.action-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-card span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

/* GRADIENT STAT CARDS ENHANCED */
.gradient {
    border: none !important;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.gradient::after {
    content: "";
    position: absolute;
    top: -20%;
    right: -10%;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    z-index: -1;
}

.card-students {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.card-classes {
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
}

.card-employees {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
}

.card-finance {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.card.gradient h3,
.card.gradient p {
    color: #fff !important;
}

.card.gradient p {
    opacity: 0.9;
    font-weight: 500;
}

/* RECENT ACTIVITY LIST */
.panel {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel ul {
    margin: 0 -28px -28px;
}

.panel li {
    padding: 16px 28px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.panel li:hover {
    background: #f8fafc;
}

.panel li:last-child {
    border-bottom: none;
}

.panel li .tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: var(--text-muted);
}

/* =========================
   RESPONSIVE OVERRIDES (LIVINGHOPE 2026)
========================= */

/* --- SHARED RESPONSIVE UTILITIES --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.table-responsive table {
    min-width: 600px;
}

@media (max-width: 1023px) {
    .table-responsive table {
        min-width: 800px;
    }
}

/* --- LARGE SCREENS (PROTECTED) --- */
@media (min-width: 1024px) {
    .sidebar {
        left: 0 !important;
    }

    .content {
        margin-left: 280px !important;
    }
}

/* --- TABLET (768px - 1023px) --- */
@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        left: -280px;
        transition: 0.3s ease;
        z-index: 1000;
    }

    .sidebar.active {
        left: 0;
    }

    .content {
        margin-left: 0 !important;
    }

    .topbar {
        padding: 10px 20px !important;
        height: auto !important;
        min-height: 75px;
    }

    .dashboard-panels {
        grid-template-columns: 1fr !important;
        padding: 0 20px 20px !important;
    }

    .cards,
    .quick-actions,
    .dashboard-header {
        padding: 20px !important;
    }

    .filter-bar,
    .summary-hub,
    .data-card,
    .executive-grid,
    .sheet-selector-hub,
    .sheet-container {
        margin-left: 20px !important;
        margin-right: 20px !important;
    }

    .executive-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* --- MOBILE (< 768px) --- */
@media (max-width: 767px) {
    .topbar {
        padding: 20px 15px !important;
        flex-direction: column !important;
        height: auto !important;
        gap: 20px !important;
    }

    /* Target all flex containers inside topbar, including nested ones */
    .topbar div[style*="display: flex"],
    .topbar div {
        flex-direction: column !important;
        align-items: flex-start !important;
        width: 100% !important;
        gap: 12px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
    }

    .topbar h1 {
        font-size: 16px !important;
        margin-bottom: 0 !important;
        line-height: 1.2 !important;
    }

    .topbar img {
        height: 40px !important;
        width: auto !important;
    }

    .topbar span[style*="opacity: 0.6"] {
        display: none !important;
    }

    .topbar div[style*="text-align: right"] {
        text-align: left !important;
        margin-top: 5px !important;
    }

    .topbar select {
        width: 100% !important;
        height: 48px !important;
        font-size: 14px !important;
    }

    /* Selector Hubs (Attendance etc) */
    .sheet-selector-hub {
        margin: 0 15px 20px !important;
        padding: 20px !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .sheet-selector-hub form {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        width: 100% !important;
    }

    .sheet-selector-hub div {
        width: 100% !important;
        margin: 0 !important;
    }

    /* Header Actions Stacking */
    .sheet-header-actions {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 20px !important;
        padding: 20px !important;
    }

    .sheet-header-actions div[style*="display: flex"] {
        flex-direction: row !important;
        /* Keep buttons horizontal if they fit, or stack if small */
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        gap: 10px !important;
    }

    /* Status Pills Grid */
    .sheet-status-group {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .status-pill {
        min-width: 0 !important;
        width: 100% !important;
        font-size: 11px !important;
        padding: 10px 5px !important;
    }

    /* Grid systems and Containers */
    .executive-grid,
    .cards,
    .quick-actions,
    .dashboard-grid,
    .filter-grid,
    .summary-hub,
    .data-card,
    .panel,
    .sheet-selector-hub,
    .sheet-container {
        grid-template-columns: 1fr !important;
        margin-left: 15px !important;
        margin-right: 15px !important;
        width: calc(100% - 30px) !important;
        gap: 15px !important;
    }

    .stat-pearl {
        padding: 20px !important;
    }

    /* Table Compactness */
    .data-table td,
    .data-table th,
    .attendance-sheet-table td,
    .attendance-sheet-table th,
    .financial-table td,
    .financial-table th {
        padding: 12px 10px !important;
        font-size: 13px !important;
    }

    /* Form Elements */
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    button:not(.tag),
    textarea {
        width: 100% !important;
        max-width: 100% !important;
        height: 50px !important;
    }

    .primary-btn,
    .link-btn,
    .btn-reset,
    .action-link-btn {
        width: 100% !important;
        justify-content: center !important;
        height: 50px !important;
        padding: 0 20px !important;
    }

    .form-panel {
        padding: 24px !important;
        margin: 0 15px 30px !important;
    }

    .dashboard-header {
        padding: 30px 15px 15px !important;
    }

    .dashboard-header div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }

    .dashboard-header h2 {
        font-size: 22px !important;
        line-height: 1.3 !important;
    }

    .hamburger {
        display: flex !important;
        position: absolute;
        top: 20px;
        right: 15px;
        margin: 0 !important;
        background: #fff !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1) !important;
        border: 1px solid var(--border) !important;
        width: 48px !important;
        height: 48px !important;
        border-radius: 12px !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 24px !important;
    }

    /* Layout correction for user info */
    .topbar>div:last-child {
        margin-top: 10px !important;
        padding-top: 15px !important;
        border-top: 1px solid var(--border) !important;
    }
}

/* --- TOGGLE COMPONENTS --- */
.hamburger {
    display: none;
    background: transparent;
    border: none;
    font-size: 32px;
    color: var(--primary);
    cursor: pointer;
    line-height: 1;
    z-index: 101;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}