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

:root {
    /* DepEd Official Colors */
    --primary: #0038a8;
    --primary-dark: #00267a;
    --accent: #f7d417;
    --secondary: #64748b;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0284c7;
    --dark: #1e293b;
    --light: #f8fafc;
    --white: #ffffff;

    /* Sidebar Colors */
    --sidebar-bg: #1a1f36;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: #3b82f6;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;

    /* UI Variables */
    --bg-body: #f1f5f9;
    --bg-header: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --dark: #f8fafc;
    --light: #0f172a;
    --white: #1e293b;
    --secondary: #94a3b8;
    
    --bg-body: #0f172a;
    --bg-header: #0f172a;
    --bg-card: #1e293b;
    --border-color: #334155;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    
    --sidebar-bg: #020617;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glass Effect */
.glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--card-shadow);
}

[data-theme="dark"] .glass {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR - Dark Style
   ═══════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    background: var(--sidebar-bg);
    padding: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Sidebar Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 32px 24px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s ease;
}

.sidebar-logo img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--white);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

/* Section Labels */
.sidebar-section-label {
    padding: 20px 20px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(148, 163, 184, 0.6);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Nav Menu */
.nav-menu {
    list-style: none;
    padding: 0 8px;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.88rem;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.nav-link i:first-child {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}


.nav-badge {
    background: var(--danger);
    color: white;
    border-radius: 10px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 6px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

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

/* ═══════════════════════════════════════════════════════════
   COLLAPSED SIDEBAR
   ═══════════════════════════════════════════════════════════ */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-chevron,
.sidebar.collapsed .nav-badge {
    display: none;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
    padding: 28px 10px;
}

.sidebar.collapsed .nav-menu {
    padding: 0 8px;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .nav-link i:first-child {
    font-size: 1.15rem;
}

/* Tooltip on hover when collapsed */
.sidebar.collapsed .nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--dark);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 1002;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar.collapsed .nav-link:hover::after {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0 24px 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════ */
.header {
    height: var(--header-height);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    position: sticky;
    top: 0;
    background: var(--bg-header);
    z-index: 100;
    transition: background-color 0.3s ease;
}

.sidebar-hamburger {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: var(--white);
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.sidebar-hamburger:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.header-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--white);
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.header-icon-btn:hover {
    background: #e2e8f0;
    color: var(--dark);
}

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */
.badge {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-light {
    background: #f1f5f9;
    color: var(--secondary);
}

.badge-info {
    background: #e0f2fe;
    color: #0284c7;
}

.badge-success {
    background: #ecfdf5;
    color: #059669;
}

.badge-danger {
    background: #fef2f2;
    color: #dc2626;
}

.badge-warning {
    background: #fffbeb;
    color: #d97706;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.88rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 56, 168, 0.2);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--secondary);
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

[data-theme="dark"] .btn-secondary {
    background: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

[data-theme="dark"] .btn-light {
    background: #1e293b !important;
    color: #f1f5f9;
    border: 1px solid #334155;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.82rem;
}

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-card);
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
    color: var(--text-main);
    font-size: 0.9rem;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 56, 168, 0.08);
}

/* ═══════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
}

.table tbody tr:hover {
    background: var(--bg-body);
}

[data-theme="dark"] .table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.animate-fade {
    animation: fadeIn 0.35s ease-out forwards;
}

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */
.login-split {
    display: flex;
    min-height: 100vh;
}

.login-left {
    flex: 1.2;
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    color: white;
    position: relative;
    overflow: hidden;
}

.login-right {
    flex: 1;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 80px;
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
    .login-left {
        display: none;
    }

    .login-right {
        flex: 1;
        padding: 40px;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    }

    .main-content {
        margin-left: 0 !important;
        padding-left: 15px;
        padding-right: 15px;
    }

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

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

/* ═══════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

/* Ensure SweetAlert is always on top */
.swal2-container {
    z-index: 9999 !important;
}


.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: var(--bg-card);
    width: 100%;
    max-width: 850px;
    max-height: 90vh;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-body);
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #fee2e2;
    color: var(--danger);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

#viewModalContent,
#editModalContent,
#createModalContent,
#importModalContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-body);
}

/* Modal Loading State */
.modal-skeleton {
    padding: 24px;
}

.skeleton-bar {
    height: 12px;
    background: #f1f5f9;
    border-radius: 6px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.skeleton-bar::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0) 100%);
    animation: skeleton-wave 1.5s infinite;
}

@keyframes skeleton-wave {
    100% {
        transform: translateX(100%);
    }
}

/* ═══════════════════════════════════════════════════════════
   PAGINATION - Custom Premium Style
   ═══════════════════════════════════════════════════════════ */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    gap: 5px;
    margin: 0;
    align-items: center;
}

.page-item {
    display: inline-block;
}

.page-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
    background-color: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: 10px !important;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-link:hover {
    color: var(--primary);
    background-color: #f1f5f9;
    border-color: var(--primary);
    z-index: 2;
}

.page-item.active .page-link {
    z-index: 3;
    color: var(--white);
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(0, 56, 168, 0.2);
}

.page-item.disabled .page-link {
    color: #cbd5e1;
    pointer-events: none;
    background-color: var(--white);
    border-color: #e2e8f0;
}

/* Fix for Laravel's Bootstrap template wrapping */
nav[role="navigation"] {
    display: flex;
    flex-direction: column;
}

nav[role="navigation"] .flex.justify-between.flex-1.sm\:hidden {
    display: none !important;
}

nav[role="navigation"] .hidden.sm\:flex-1.sm\:flex.sm\:items-center.sm\:justify-between {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100%;
    gap: 20px;
}

/* Hide the redundant "Showing" text from Laravel if needed, 
   but since we want it, we'll just style it. */
nav[role="navigation"] p.text-sm.text-gray-700,
nav[role="navigation"] div p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--secondary);
    font-weight: 500;
}

nav[role="navigation"] span.font-medium,
nav[role="navigation"] div p span {
    font-weight: 700;
    color: var(--dark);
}

/* Hide SVG icons if they are too big */
nav[role="navigation"] svg {
    width: 16px;
    height: 16px;
}

/* ═══════════════════════════════════════════════════════════
   SIMPLE PAGINATION BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn-pagination {
    padding: 8px 20px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: var(--white);
    color: var(--secondary);
    transition: all 0.2s ease;
}

.btn-pagination:hover:not(.disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--dark);
}

.btn-pagination.active {
    background: #4f46e5;
    color: var(--white);
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-pagination.active:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.btn-pagination.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}