/* Plus Jakarta Sans & Inter Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #0ea5e9;
    --primary-color: #0ea5e9;
    --primary-hover: #0284c7;
    --secondary: #0f2133;
    --secondary-color: #0f2133;
    --accent-color: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #f4f7fa;
    --bg-color: #f4f7fa;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;

    /* Sidebar specific */
    --sidebar-width: 244px;
    --sidebar-bg: #0f2133;
    --sidebar-text: #94a3b8;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: #0ea5e9;

    --navbar-bg: #ffffff;
    --radius-lg: 12px;
    --radius-md: 8px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.03);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Theme Element Colors */
    --btn-bg: #0ea5e9;
    --btn-text: #ffffff;
    --btn-hover-bg: #0284c7;
    --input-bg: #ffffff;
    --input-text: #0f172a;
    --input-border: #cbd5e1;
    --card-padding: 20px;
    --card-margin: 18px;
    --table-th-bg: #f8fafc;
    --table-th-text: #64748b;
    --table-td-bg: #ffffff;
    --table-td-text: #0f172a;
    --table-border: #e2e8f0;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --background: #0b1120;
    --card-bg: #111827;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #1e293b;
    --navbar-bg: #111827;
    --sidebar-bg: #09131f;
    --sidebar-hover: #1e293b;
    --table-th-bg: #1e293b;
    --table-th-text: #94a3b8;
    --table-td-bg: #111827;
    --table-td-text: #f8fafc;
    --table-border: #1e293b;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    overflow-x: hidden;
    font-size: 13.5px;
    -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ==========================================
   SIDEBAR (GST / SaaS ERP Dark Navy Style)
   ========================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #ffffff;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    border-right: none;
}

.sidebar.collapsed {
    width: 76px;
}

.sidebar-brand-card {
    margin: 12px 12px 6px 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #fff;
}

.sidebar-brand-meta {
    min-width: 0;
    flex: 1;
}

.sidebar-brand-title {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 10px;
    font-weight: 500;
    color: #7dd3fc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

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

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0 24px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Hide Scrollbar Gutter so Active Menu attaches flush to body */
.sidebar-menu::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.menu-category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 14px 18px 6px 18px;
}

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

/* Menu Item & Exact Pill Cutout Shape with Concave Curves (Zero Layout Shift) */
.menu-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 6px 14px 6px 6px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    height: 44px;
    min-height: 44px;
    transition: none;
    margin: 4px 0 4px 12px;
    border-radius: 50px 0 0 50px;
    cursor: pointer;
}

.sidebar.collapsed .menu-item {
    padding: 6px;
    justify-content: center;
    margin: 4px 10px;
    border-radius: 12px;
}

.menu-item i {
    font-size: 15px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 10px;
    border-radius: 50%;
    transition: none;
}

.menu-item .bi-chevron-down,
.menu-item .fa-chevron-down {
    width: auto;
    height: auto;
    margin-right: 6px;
    font-size: 10px;
    opacity: 0.7;
}

.menu-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.collapsed .menu-item span,
.sidebar.collapsed .menu-item .bi-chevron-down {
    display: none;
}

.menu-item:hover {
    background-color: var(--sidebar-hover);
    color: #f8fafc;
}

/* Active Top-Level Menu Pill Cutout (Same dimensions, zero jump) */
.sidebar-menu > .menu-item.active {
    background-color: var(--background) !important;
    color: #0284c7 !important;
    font-weight: 600;
    border-radius: 50px 0 0 50px;
    padding: 6px 14px 6px 6px;
    margin: 4px 0 4px 12px;
    height: 44px;
    z-index: 2;
}

.sidebar-menu > .menu-item.active .bi-chevron-down,
.sidebar-menu > .menu-item.active .fa-chevron-down {
    opacity: 0;
    pointer-events: none;
}

.sidebar-menu > .menu-item.active > i:first-child,
.sidebar-menu > .menu-item.active > div > i:first-child {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 100%);
    color: #ffffff;
    margin-right: 10px;
    box-shadow: 0 3px 10px rgba(14, 165, 233, 0.35);
}

.sidebar-menu > .menu-item.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: -16px;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 0 0, transparent 16px, var(--background) 16.5px);
    pointer-events: none;
}

.sidebar-menu > .menu-item.active::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: -16px;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 0 100%, transparent 16px, var(--background) 16.5px);
    pointer-events: none;
}

.sidebar.collapsed .sidebar-menu > .menu-item.active::before,
.sidebar.collapsed .sidebar-menu > .menu-item.active::after {
    display: none;
}

/* Submenu container & items (Clean dark rounded active card + blue | sign on right) */
.sidebar-submenu-wrap {
    margin: 4px 12px 8px 18px;
    padding-left: 0;
    border-left: none;
}

.sidebar-submenu-wrap .menu-item {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 12px;
    margin: 2px 0 2px 4px;
    border-radius: 9px 0 0 9px;
}

.sidebar-submenu-wrap .menu-item i {
    width: 18px;
    height: 18px;
    font-size: 12px;
    margin-right: 6px;
}

.sidebar-submenu-wrap .menu-item.active::after {
    height: 18px;
    width: 4px;
    background-color: #0ea5e9;
}

/* ==========================================
   MAIN CONTENT WRAPPER & TOP NAVBAR
   ========================================== */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-collapsed-active .main-wrapper {
    margin-left: 76px;
}

.navbar-modern {
    height: 60px;
    background-color: var(--navbar-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

/* Topbar Badges & Buttons */
.erp-pill-id {
    background: #eff6ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
}

.erp-pill-db {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.erp-pill-db::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

.btn-erp-emerald {
    background: #10b981 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}
.btn-erp-emerald:hover {
    background: #059669 !important;
    color: #ffffff !important;
}

.btn-erp-cyan {
    background: #0ea5e9 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}
.btn-erp-cyan:hover {
    background: #0284c7 !important;
    color: #ffffff !important;
}

.btn-erp-outline {
    background: #ffffff !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}
.btn-erp-outline:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

/* Page Containers */
.page-container {
    padding: 16px 24px 24px 24px;
    flex: 1;
}

/* ==========================================
   ERP DASHBOARD & CARD COMPONENTS
   ========================================== */
.erp-breadcrumb-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.erp-back-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    text-decoration: none;
}

.erp-hero-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.erp-kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
    height: 100%;
    transition: var(--transition);
}
.erp-kpi-card:hover {
    border-color: #bae6fd;
    box-shadow: var(--shadow-lg);
}

.erp-kpi-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.erp-kpi-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 4px 0 6px 0;
    line-height: 1.2;
}

.erp-icon-tile {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.erp-section-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.erp-shortcut-tile {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    text-decoration: none;
    transition: var(--transition);
    height: 100%;
}
.erp-shortcut-tile:hover {
    border-color: #38bdf8;
    background: #f0f9ff;
    transform: translateY(-1px);
}
.erp-shortcut-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}
.erp-shortcut-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

/* Modern Cards (backward compatible across all School ERP sub-pages) */
.card-modern {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow);
    padding: var(--card-padding);
    transition: var(--transition);
    margin-bottom: var(--card-margin);
}

.card-header-modern {
    background-color: var(--secondary) !important;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    margin: calc(-1 * var(--card-padding)) calc(-1 * var(--card-padding)) var(--card-padding) calc(-1 * var(--card-padding));
}

.p-0 > .card-header-modern,
.card-modern.p-0 .card-header-modern {
    margin: 0 !important;
}

.card-header-modern h1,
.card-header-modern h2,
.card-header-modern h3,
.card-header-modern h4,
.card-header-modern h5,
.card-header-modern h6 {
    margin: 0 !important;
    color: #ffffff !important;
}

/* Buttons */
.btn {
    border-radius: 8px !important;
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--btn-bg) !important;
    border-color: var(--btn-bg) !important;
    color: var(--btn-text) !important;
}

.btn-primary:hover {
    background-color: var(--btn-hover-bg) !important;
    border-color: var(--btn-hover-bg) !important;
}

/* Tables Redesign */
.table-responsive-modern {
    border: 1px solid var(--table-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-modern {
    margin-bottom: 0;
    background-color: var(--table-td-bg);
}

.table-modern th {
    background-color: var(--table-th-bg);
    color: var(--table-th-text);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--table-border);
}

.table-modern td {
    padding: 12px 16px;
    color: var(--table-td-text);
    background-color: var(--table-td-bg);
    border-bottom: 1px solid var(--table-border);
    font-size: 13px;
}

.table-modern tr:last-child td {
    border-bottom: none;
}

.table-modern tr:hover td {
    background-color: #f8fafc;
}

/* Forms & Modals */
.form-control-modern,
.form-control,
.form-select {
    border-radius: 8px !important;
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--input-text);
    font-size: 13px;
}

.form-control:focus,
.form-select:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.badge-modern,
.badge {
    padding: 5px 10px;
    border-radius: 9999px !important;
    font-weight: 600;
    font-size: 11px;
}

.modal-content {
    border-radius: 14px !important;
    border: 1px solid var(--border);
}

/* Animations */
.animate-fade-in { animation: fadeIn 0.25s ease-out forwards; }
.animate-slide-up { animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile View Adjustments */
@media (max-width: 991px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.45);
    }
    .sidebar.mobile-open {
        left: 0;
    }
    .main-wrapper {
        margin-left: 0 !important;
    }
    .page-container {
        padding: 12px;
    }
    .navbar-modern {
        padding: 0 14px;
    }
}

/* Smooth top-to-bottom dropdown animation in sidebar (zero margin-collapse snap) */
.sidebar-menu .collapse {
    overflow: hidden;
}
.sidebar-menu .collapsing {
    height: 0;
    overflow: hidden;
    transition: height 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
/* Override inline submenu styles from sidebar.blade.php for uniform SaaS ERP look */
.sidebar-menu .collapse > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 !important;
    padding: 4px 12px 8px 18px !important;
    border-left: none !important;
}
.sidebar-menu .collapse .menu-item {
    padding: 0 14px 0 24px !important;
    font-size: 12.5px !important;
    min-height: 36px !important;
    height: 36px !important;
    margin: 0 !important;
    border-radius: 10px !important;
    color: #94a3b8 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.sidebar-menu .collapse .menu-item:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #e2e8f0 !important;
}
.sidebar-menu .collapse .menu-item i.bi-dash {
    display: none !important;
}
.sidebar-menu .collapse .menu-item.active {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #0ea5e9 !important;
    font-weight: 600 !important;
}
.sidebar-menu .collapse .menu-item.active::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background-color: #ffffff;
    border-radius: 99px;
}

/* 3D Isometric & Floating Animations for Landing Website */
.erp-3d-tilt {
    transform: rotateY(-4deg) rotateX(2deg);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}
.erp-3d-tilt:hover {
    transform: rotateY(0deg) rotateX(0deg) translateY(-4px);
}
@keyframes erpFloatSlow {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-7px); }
}
.erp-float-slow {
    animation: erpFloatSlow 4s ease-in-out infinite;
}
.erp-float-delayed {
    animation: erpFloatSlow 4.5s ease-in-out 1.2s infinite;
}
