/* ==========================================================================
   FlyGest Multi-Tenant Enterprise Theme
   ========================================================================== */

:root {
    --tenant-primary: #030637;      /* Deep midnight blue matching screenshot */
    --tenant-secondary: #4361ee;    /* Vibrant accent blue */
    --tenant-accent: #5b8bf7;       /* Soft blue highlight for active pills */
    
    --bg-page: #030637;             /* Dark upper page canvas background */
    --bg-sidebar: #f3f5f9;          /* Clean light gray sidebar */
    --bg-card: #ffffff;             /* Crisp card background */
    
    --text-primary: #1e293b;        /* Dark slate body text */
    --text-muted: #64748b;          /* Subdued descriptive text */
    --text-light: #ffffff;          /* White text */
    
    --border-subtle: #e2e8f0;       /* Card and table dividers */
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

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

/* Prevent outer body double-scrolling in dashboard view */
body.app-layout {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* ==========================================================================
   App Shell Layout Grid (Sidebar + Main Canvas)
   ========================================================================== */
.app-shell {
    display: flex;
    height: 100vh;
    max-height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ----------------- Left Sidebar (Fixed 100vh Window Height) ----------------- */
.sidebar-wrapper,
aside.sidebar-wrapper {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    height: 100vh;
    max-height: 100vh;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    overflow: hidden;
}

/* Compatibility helper when sub-modules embed <aside class="sidebar"> */
.sidebar-content > aside.sidebar {
    display: block;
    background: transparent;
    border: none;
    width: 100%;
    height: auto;
    min-width: 0;
    max-width: 100%;
}

.sidebar-brand {
    padding: 24px 20px 16px;
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-icon-box {
    width: 40px;
    height: 40px;
    background: var(--tenant-primary);
    color: #ffffff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.tenant-logo-icon {
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.brand-meta {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
    color: #0f172a;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* CTA Action Button */
.sidebar-cta {
    padding: 0 16px 16px;
    flex-shrink: 0;
}

.btn-sidebar-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background-color: var(--tenant-primary);
    color: #ffffff !important;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(3, 6, 55, 0.2);
    transition: all 0.2s ease;
}

.btn-sidebar-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(3, 6, 55, 0.3);
    background-color: color-mix(in srgb, var(--tenant-primary) 85%, #000);
}

/* Scrollable Nav Items Area */
.sidebar-content {
    flex: 1 1 auto;
    padding: 0 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    transition: all 0.15s ease;
    text-decoration: none;
}

.sidebar-nav .nav-link i {
    font-size: 1.15rem;
    opacity: 0.8;
}

.sidebar-nav .nav-link:hover {
    color: var(--tenant-primary);
    background-color: rgba(0, 0, 0, 0.04);
}

/* Active Menu Item Pill (matching light blue highlight in screenshot) */
.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link.bg-primary {
    background-color: var(--tenant-accent, #5b8bf7) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(91, 139, 247, 0.3) !important;
}

.sidebar-nav .nav-link.active i,
.sidebar-nav .nav-link.bg-primary i {
    opacity: 1;
    color: #ffffff;
}

/* Bottom Sidebar Actions (Pinned at window bottom) */
.sidebar-footer {
    margin-top: auto;
    padding: 14px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.sidebar-footer .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    border-radius: var(--radius-md);
    text-decoration: none;
}

.sidebar-footer .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.04);
    color: #1e293b;
}

.text-danger-hover:hover {
    color: #ef4444 !important;
}

/* ----------------- Main Canvas (Scrollable Viewport) ----------------- */
.main-canvas {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--tenant-primary);
}

.top-nav-bar {
    background-color: var(--tenant-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 18px 36px;
    flex-shrink: 0;
}

.top-nav-container {
    display: flex;
    align-items: center;
    gap: 32px;
}

.top-brand-name a {
    font-size: 1.35rem;
    font-weight: 800;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.top-modules-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.top-nav-link {
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 6px 0;
    position: relative;
    transition: color 0.2s ease;
}

.top-nav-link:hover {
    color: #ffffff;
}

/* Active Top Tab with bottom indicator */
.top-nav-link.active {
    color: #ffffff;
    font-weight: 600;
}

.top-nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -19px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #ffffff;
    border-radius: 2px 2px 0 0;
}

.user-avatar-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px 6px 6px;
    border-radius: 50px;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-initials {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--tenant-accent, #5b8bf7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ----------------- Header Banner & Content Area ----------------- */
.page-header-banner {
    padding: 36px 36px 28px;
    background-color: var(--tenant-primary);
    color: #ffffff;
    flex-shrink: 0;
}

.page-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.page-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* Search bar & Filter bar in banner */
.header-actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-search-wrap {
    position: relative;
    min-width: 260px;
}

.header-search-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.header-search-input {
    background-color: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border-radius: 50px !important;
    padding: 8px 16px 8px 36px !important;
    font-size: 0.88rem;
    transition: background-color 0.2s ease;
}

.header-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

.header-search-input:focus {
    background-color: rgba(255, 255, 255, 0.2) !important;
    box-shadow: none !important;
}

.btn-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--tenant-secondary, #4361ee);
    color: #ffffff !important;
    border: none;
    border-radius: 50px;
    padding: 8px 18px;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.btn-filter-pill:hover {
    background-color: color-mix(in srgb, var(--tenant-secondary, #4361ee) 85%, #000);
}

/* ----------------- White Content Card / Data Table ----------------- */
.page-content-area {
    flex: 1 0 auto;
    padding: 0 36px 36px;
    background-color: var(--tenant-primary);
}

.content-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    padding: 0;
}

.card-header-clean {
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Clean Modern Table (MagisEd style) */
.table-custom {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}

.table-custom thead th {
    background-color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 16px 24px;
    vertical-align: middle;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
}

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

.table-custom tbody tr:hover {
    background-color: #fafbfe;
}

/* Status Badges */
.badge-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.75rem;
}

.badge-confirmed {
    background-color: #cffafe;
    color: #0891b2;
}

.badge-pending {
    background-color: #e0e7ff;
    color: #4f46e5;
}

.badge-waitlisted {
    background-color: #fee2e2;
    color: #dc2626;
}

/* Avatar Chips */
.user-chip-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #ffffff;
    margin-right: 12px;
}

/* Pagination Bar */
.table-pagination-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.pagination-custom {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination-custom .page-link-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
}

.pagination-custom .page-link-btn.active {
    background-color: var(--tenant-primary);
    color: #ffffff;
}

/* Footer */
.app-footer {
    padding: 16px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    background-color: var(--tenant-primary);
    flex-shrink: 0;
}

/* ==========================================================================
   Auth Layout (Login & MFA verification screens)
   ========================================================================== */
.auth-layout {
    background-color: var(--tenant-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.auth-shell-wrapper,
.auth-canvas,
.auth-content-area {
    width: 100%;
    min-height: 100vh;
}

.auth-container {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    padding: 20px;
    position: relative;
}

.auth-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(3, 6, 55, 0.75), rgba(3, 6, 55, 0.95));
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.auth-logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.login-logo-img {
    max-height: 52px;
    object-fit: contain;
}

.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-form label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
    display: block;
}

.auth-form .form-control {
    border-radius: var(--radius-md);
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    font-size: 0.9rem;
}

.auth-form .form-control:focus {
    border-color: var(--tenant-secondary, #4361ee);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.form-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #475569;
}

.btn-primary,
.btn-block {
    background-color: var(--tenant-primary);
    border-color: var(--tenant-primary);
    color: #ffffff;
    font-weight: 700;
    border-radius: var(--radius-md);
    padding: 10px 16px;
    width: 100%;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: color-mix(in srgb, var(--tenant-primary) 85%, #000);
    border-color: color-mix(in srgb, var(--tenant-primary) 85%, #000);
}

/* ==========================================================================
   Responsive Mobile Adjustments
   ========================================================================== */
@media (max-width: 991px) {
    .sidebar-wrapper,
    aside.sidebar-wrapper {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
    }

    .sidebar-wrapper.active,
    aside.sidebar-wrapper.active {
        transform: translateX(0);
        box-shadow: 10px 0 25px rgba(0, 0, 0, 0.3);
    }

    .top-modules-nav {
        display: none;
    }

    .page-header-banner,
    .page-content-area,
    .top-nav-bar {
        padding-left: 20px;
        padding-right: 20px;
    }
}