/* ==========================================================================
   MEB Pasaport - Navigation Bar & PDF Flipbook Component Stylesheet
   Design Philosophy: Refined Administrative Modernism
   ========================================================================== */

:root {
    --nav-height: 70px;
    --nav-bg: rgba(30, 58, 95, 0.95); /* Deep MEB Blue */
    --nav-text: #ffffff;
    --nav-text-hover: #e2e8f0;
    --nav-accent: #c41e3a; /* MEB Crimson */
    --nav-font-display: 'Titillium Web', sans-serif;
    --nav-font-ui: 'Titillium Web', sans-serif;
    --nav-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --nav-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
    --nav-glass-border: rgba(255, 255, 255, 0.1);
}

/* Base Body Modifications for Sticky Layout */
body.has-navbar {
    display: block !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}
body.has-navbar .layout-body-wrapper {
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin-top: var(--nav-height);
    position: relative;
    z-index: 1;
}

/* --- Navigation Container --- */
.custom-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--nav-glass-border);
    box-shadow: var(--nav-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 1030;
    font-family: var(--nav-font-ui);
    box-sizing: border-box;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.nav-brand-logo {
    width: 48px;
    height: 48px;
    background: #ffffff;
    border-radius: 50%;
    padding: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.nav-brand-logo img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.nav-brand-text {
    display: flex;
    flex-direction: column;
}

.nav-brand-title {
    color: #ffffff;
    font-family: var(--nav-font-display);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
}

.nav-brand-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-top: 2px;
}

/* --- Nav Menu Links --- */
.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.5rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--nav-transition);
}

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--nav-accent);
    transition: var(--nav-transition);
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-item.active .nav-link::after {
    width: 100%;
}

.nav-link i {
    font-size: 1rem;
}

/* --- Dropdown Styles --- */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1e3a5f;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    min-width: 260px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: var(--nav-transition);
    z-index: 10000;
}

.nav-dropdown::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    height: 15px;
    background: transparent;
}

.nav-item:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.8);
    padding: 10px 14px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    transition: var(--nav-transition);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(4px);
}

.dropdown-item i {
    font-size: 0.95rem;
    color: var(--nav-accent);
}

/* --- Actions Button --- */
.nav-btn-login {
    background: linear-gradient(135deg, var(--nav-accent) 0%, #a01830 100%);
    color: #ffffff !important;
    padding: 8px 20px !important;
    border-radius: 30px;
    font-weight: 600;
    border: none;
    box-shadow: 0 4px 10px rgba(196, 30, 62, 0.3);
    transition: var(--nav-transition) !important;
}

.nav-btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(196, 30, 62, 0.4);
    filter: brightness(1.1);
}

.nav-btn-login::after {
    display: none !important;
}

/* --- Mobile Toggle --- */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 10001;
}

/* --- Sidebar Drawer (Mobile) --- */
.nav-drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: #102238;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    padding: 80px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-sizing: border-box;
}

.nav-drawer.open {
    right: 0;
}

.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: var(--nav-transition);
}

.drawer-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.drawer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.drawer-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-link.nav-btn-login {
    border-bottom: none !important;
}

.drawer-dropdown-toggle {
    cursor: pointer;
    justify-content: space-between;
}

.drawer-dropdown-menu {
    list-style: none;
    padding: 0 0 0 16px;
    margin: 8px 0 0 0;
    display: none;
    flex-direction: column;
    gap: 8px;
}

.drawer-dropdown-menu.open {
    display: flex;
}

.drawer-dropdown-item {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 0;
    display: block;
}

/* ==========================================================================
   FAQ (SSS) MODAL STYLE
   ========================================================================== */
.faq-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    z-index: 10100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--nav-transition);
}
.faq-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}
.faq-modal {
    background: #ffffff;
    width: 90%;
    max-width: 750px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
.faq-modal-overlay.show .faq-modal {
    transform: translateY(0);
}
.faq-modal-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #102238 100%);
    padding: 20px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
}
.faq-modal-header h3 {
    margin: 0;
    font-family: var(--nav-font-display);
    font-size: 1.4rem;
    font-weight: 700;
}
.faq-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--nav-transition);
}
.faq-close-btn:hover {
    color: #ffffff;
    transform: scale(1.1);
}
.faq-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    background: #f8fafc;
}
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.faq-accordion {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: var(--nav-transition);
}
.faq-accordion-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: #1e3a5f;
    font-size: 0.95rem;
}
.faq-accordion-header i {
    transition: var(--nav-transition);
    color: var(--nav-accent);
}
.faq-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
    background: #f1f5f9;
}
.faq-accordion-content {
    padding: 16px 20px;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #475569;
}
.faq-accordion.open {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.faq-accordion.open .faq-accordion-header i {
    transform: rotate(180deg);
}
.faq-accordion.open .faq-accordion-body {
    max-height: 1000px;
    transition: max-height 0.4s cubic-bezier(1, 0, 1, 0);
}

/* ==========================================================================
   PDF FLIPBOOK MODAL STYLE
   ========================================================================== */
.flipbook-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    z-index: 10200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--nav-transition);
}

.flipbook-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.flipbook-modal-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #090d16;
    border-radius: 0;
    overflow: hidden;
    border: none;
    box-shadow: none;
}

.flipbook-modal-header {
    background: #0b0f19;
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 32px 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.flipbook-modal-header h3 {
    margin: 0;
    color: #ffffff;
    font-family: var(--nav-font-display);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.flipbook-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #ffffff;
}

.fb-ctrl-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.fb-ctrl-btn:hover {
    background: var(--nav-accent);
    border-color: var(--nav-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196, 30, 62, 0.4);
}

.fb-ctrl-btn:disabled {
    background: rgba(255, 255, 255, 0.01);
    border-color: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.fb-ctrl-btn.close-btn {
    background: #ef4444;
    border-color: #ef4444;
}
.fb-ctrl-btn.close-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.fb-divider {
    color: rgba(255, 255, 255, 0.15);
    font-size: 1.2rem;
}

#fbPageNum {
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 100px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.95);
}

.flipbook-modal-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #05070c;
    padding: 20px;
}

/* --- The Flipbook viewport --- */
.flipbook-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-sizing: border-box;
}

.flipbook-book {
    position: relative;
    width: 600px; /* Base size, JavaScript adjusts dynamically */
    height: 800px;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Flipbook Sheets (Single-page Deck layout) --- */
.fb-sheet {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    visibility: hidden;
    transform: translate3d(50px, 0, 0) scale(0.96);
    transition: opacity 0.45s cubic-bezier(0.25, 0.8, 0.25, 1), 
                transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1), 
                visibility 0.45s;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
}

.fb-sheet.active {
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0) scale(1);
    z-index: 2;
}

.fb-sheet.prev {
    opacity: 0;
    visibility: hidden;
    transform: translate3d(-50px, 0, 0) scale(0.96);
    z-index: 1;
}

.fb-page-front {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: hidden;
}

.fb-sheet canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
    display: block;
    object-fit: contain;
}

/* Spinner and error layouts */
.fb-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #ffffff;
    position: absolute;
    z-index: 10;
}

.fb-loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--nav-accent);
    border-radius: 50%;
    animation: fb-spin 1s infinite linear;
}

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

.fb-error {
    color: #ef4444;
    text-align: center;
    padding: 40px;
    max-width: 400px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.fb-error h4 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.fb-error p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

/* --- Mobile Compatibility Overrides --- */
@media (max-width: 992px) {
    .custom-navbar {
        padding: 0 1rem;
    }
    
    .nav-menu {
        display: none; /* Hide standard nav list on tablets/mobiles */
    }
    
    .nav-toggle {
        display: block; /* Show hamburger toggle */
    }
}

@media (max-width: 768px) {
    .flipbook-modal-header {
        padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px 16px !important;
    }

    .flipbook-controls {
        gap: 6px;
    }
    
    .fb-ctrl-btn {
        width: 32px;
        height: 32px;
    }
    
    .flipbook-modal-header h3 {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    #fbPageNum {
        font-size: 0.8rem;
        min-width: 60px;
    }

    .fb-divider {
        display: none !important;
    }
}

/* ==========================================================================
   ADMIN PROFILE IN NAVBAR
   ========================================================================== */
.user-profile-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    margin-right: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.user-name-small {
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Drawer User Profile */
.drawer-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.drawer-user-info .user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
}

.drawer-user-info .user-details {
    display: flex;
    flex-direction: column;
}

.drawer-user-info .user-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-user-info .user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.72rem;
    margin-top: 1px;
}

/* --- Chevron and Logout Styles --- */
.nav-link .bi-chevron-down {
    font-size: 0.75rem;
}

.nav-btn-logout {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3) !important;
}

.nav-btn-logout:hover {
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.4) !important;
    filter: brightness(1.1);
}

.nav-btn-admin {
    background: linear-gradient(135deg, #475569 0%, #334155 100%) !important;
    box-shadow: 0 4px 10px rgba(71, 85, 105, 0.3) !important;
}

.nav-btn-admin:hover {
    box-shadow: 0 6px 15px rgba(71, 85, 105, 0.4) !important;
    filter: brightness(1.1);
}

.drawer-menu .drawer-logout-item {
    margin-top: 1.5rem;
}

.drawer-menu .nav-btn-logout,
.drawer-menu .nav-btn-admin {
    justify-content: center;
}

