/* =========================================================================
   GLOBAL STYLESHEET - SDN PADURENAN 1
   ========================================================================= */

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

:root {
    /* Color Palette */
    --primary-color: #1e3a8a;       /* Deep Oxford Navy Blue */
    --primary-hover: #172554;
    --primary-light: #eff6ff;
    --secondary-color: #0f172a;     /* Dark Slate (Blackish) */
    --secondary-hover: #1e293b;
    --secondary-light: #f1f5f9;
    --dark-color: #0f172a;          /* Slate Dark (for headings) */
    --text-color: #475569;          /* Slate Grey (for body text) */
    --light-bg: #f8fafc;            /* Cool Light Background */
    --white: #ffffff;
    --border-color: #e2e8f0;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    --gradient-accent: linear-gradient(135deg, #1e3a8a 0%, var(--secondary-color) 100%);
    --gradient-dark: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    
    /* Fonts */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Layout Constants */
    --navbar-height: 80px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;       /* Modern refined borders */
    --border-radius-lg: 20px;
    --box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
    --box-shadow-hover: 0 20px 40px rgba(15, 23, 42, 0.12);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset CSS */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--dark-color);
    font-weight: 700;
    line-height: 1.25;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
p { margin-bottom: 1rem; }

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* UI Elements */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section-padding {
    padding: 5rem 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.75rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 8px; /* Elegant refined borders */
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #172554 100%);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #1e293b 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--secondary-hover) 0%, #0f172a 100%);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.1);
}

/* Header & Navbar */
.navbar-header {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--navbar-height);
    transition: var(--transition);
}

.navbar-header.scrolled {
    height: var(--navbar-height);
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: auto;
    order: 1;
}

.logo-brand img {
    height: 45px;
    width: auto;
}

.brand-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--dark-color);
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    order: 2;
}

.navbar-action-wrapper {
    order: 3;
}

.nav-link {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-color);
    position: relative;
    padding: 0.5rem 0;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
}

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

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

.nav-btn {
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
}

.mobile-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--dark-color);
    border-radius: 3px;
    transition: var(--transition);
}

/* Page Header banner (for subpages) */
.page-header {
    position: relative;
    padding: 8rem 0 4rem;
    background: linear-gradient(rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.6)), url('../picture/carousel_bg.png') center/cover;
    color: var(--white);
    text-align: center;
}

.page-header h1 {
    color: var(--white);
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Footer Section */
.footer-section {
    background-color: #1e3a5f;
    color: #e2e8f0;
    padding: 4rem 0 2rem;
    font-size: 0.9rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 1.5fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-col h3 {
    color: var(--white);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-col h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer-about p {
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    transition: var(--transition);
}

.social-icon:hover {
    background-color: var(--primary-color);
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: #cbd5e1;
}

.footer-links a:hover {
    color: var(--white);
    padding-left: 5px;
}

.footer-contact li {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.footer-contact i {
    color: var(--primary-color);
    margin-top: 0.2rem;
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.newsletter-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 4px;
    outline: none;
    background-color: rgba(255, 255, 255, 0.9);
}

.newsletter-form button {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0 1.25rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.newsletter-form button:hover {
    background-color: var(--primary-hover);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
    text-align: center;
    font-size: 0.85rem;
}

/* Responsiveness */
@media (max-width: 992px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.6rem; }
    
    .mobile-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: var(--navbar-height);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--navbar-height));
        background-color: var(--white);
        flex-direction: column;
        padding: 3rem 2rem;
        gap: 2rem;
        box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
        transition: var(--transition);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* =========================================================================
   ADMIN MODE STYLES (EDIT ICONS & CONTROLS)
   ========================================================================= */

.edit-text-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    color: var(--primary-color);
    font-size: 0.9rem;
    opacity: 0.6;
    transition: var(--transition);
    cursor: pointer;
    vertical-align: middle;
}

.edit-text-btn:hover {
    opacity: 1;
    color: var(--primary-hover);
}

.edit-image-container {
    position: relative;
    display: block;
    width: 100%;
}

.edit-image-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: var(--white);
    color: var(--primary-color);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    z-index: 10;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    outline: none;
}

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

/* Admin Library Borrow Management Section */
.admin-management-section {
    background-color: var(--white);
    border-radius: var(--border-radius-md);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 3rem;
    border: 1px dashed var(--primary-color);
}

.admin-management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.admin-management-header h3 {
    font-size: 1.35rem;
    color: var(--primary-color);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.admin-table th, .admin-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background-color: var(--light-bg);
    font-weight: 600;
    color: var(--dark-color);
}

.admin-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.admin-badge-pending {
    background-color: #fef3c7;
    color: #d97706;
}

.admin-badge-borrowed {
    background-color: #dbeafe;
    color: #2563eb;
}

.admin-badge-returned {
    background-color: #d1fae5;
    color: #059669;
}

/* =========================================================================
   CUSTOM MODAL STYLES (LOGOUT & AUTH MODALS)
   ========================================================================= */

.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeInModal 0.2s ease-out forwards;
    padding: 1rem;
    box-sizing: border-box;
}

.custom-modal-card {
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
    text-align: center;
    animation: slideUpModal 0.2s ease-out forwards;
    box-sizing: border-box;
}

/* Specific size for auth modal */
.auth-modal-card {
    max-width: 430px;
    padding: 2.5rem 2.25rem;
}

/* Redefined Close Modal Button */
.custom-modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 1.4rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s ease;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-modal-close:hover {
    color: #ef4444;
}

/* Tabs style */
.auth-tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 2rem;
    width: 100%;
}

.auth-tab-btn {
    border: none;
    background: transparent;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #64748b;
    flex: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    position: relative;
    font-family: var(--font-heading);
}

.auth-tab-btn:hover {
    color: #1e293b;
}

.auth-tab-btn.active {
    color: var(--primary-color);
}

.auth-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
}

/* Auth Screens & Contents */
.auth-modal-screen {
    width: 100%;
    text-align: left;
}

.auth-tab-content {
    animation: fadeInTab 0.15s ease-out forwards;
}

@keyframes fadeInTab {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-modal-header {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
    text-align: left;
}

.auth-modal-subheader {
    font-size: 0.88rem;
    color: #64748b;
    margin-bottom: 1.75rem;
    text-align: left;
    line-height: 1.5;
}

/* Header with Back button wrapper */
.auth-screen-header-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    margin-top: 0.25rem;
}

.auth-screen-header-wrapper .auth-modal-header {
    margin: 0 !important;
    line-height: 1.1 !important;
}

.auth-back-btn {
    border: none;
    background-color: #f1f5f9;
    color: #64748b;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    font-size: 0.9rem;
    text-decoration: none;
    flex-shrink: 0;
}

.auth-back-btn:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

/* Inputs styling */
.auth-form-group {
    position: relative;
    margin-bottom: 1.25rem;
}

.auth-form-input {
    width: 100%;
    padding: 0.8rem 1.1rem 0.8rem 2.75rem !important;
    border: 1.5px solid #cbd5e1 !important;
    background-color: #ffffff !important;
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    outline: none !important;
    transition: border-color 0.15s ease !important;
    color: #0f172a !important;
    font-family: 'Inter', sans-serif !important;
    box-sizing: border-box !important;
}

.auth-form-input:focus {
    border-color: var(--primary-color) !important;
}

.auth-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.95rem;
    pointer-events: none;
    transition: color 0.15s ease;
}

.auth-form-input:focus + .auth-input-icon,
.auth-form-input:focus ~ .auth-input-icon {
    color: var(--primary-color) !important;
}

.auth-form-input.password-input {
    padding-right: 2.75rem !important;
}

.password-toggle-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.95rem;
    cursor: pointer;
    transition: color 0.15s ease;
    z-index: 10;
}

.password-toggle-icon:hover {
    color: var(--primary-color);
}

/* Submit Button */
.btn-auth-submit {
    width: 100%;
    border-radius: 8px;
    font-weight: 600;
    padding: 0.85rem;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    color: #ffffff;
    border: none;
    background-color: var(--primary-color);
    transition: all 0.2s ease;
}

.btn-auth-submit:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
}

/* Auth Modal Footers */
.auth-modal-footer {
    text-align: center;
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.auth-modal-footer p {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

.auth-modal-footer p a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-modal-footer p a:hover {
    text-decoration: underline;
    color: #3730a3;
}

/* Animations for modal transitions */
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpModal {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* =========================================================================
   MOBILE RESPONSIVENESS OPTIMIZATIONS (SCALING DOWN ALL ELEMENTS)
   ========================================================================= */

@media (max-width: 768px) {
    html {
        font-size: 14px; /* Global scale down */
    }

    body {
        font-size: 0.95rem;
    }

    .container {
        padding: 0 1rem;
    }

    .section-padding {
        padding: 3.5rem 0;
    }

    h1 { font-size: 1.85rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    /* Shrink Nav & Header */
    .navbar-header {
        height: 70px;
    }
    .nav-menu {
        top: 70px !important;
        height: calc(100vh - 70px) !important;
    }
    .logo-brand img {
        height: 38px;
    }
    .brand-text {
        font-size: 1.1rem;
    }

    /* Shrink Buttons */
    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.85rem;
    }

    /* Shrink Modals & Auth Card on Mobile */
    .custom-modal-card {
        padding: 1.75rem 1.5rem;
        border-radius: 12px;
    }
    .auth-modal-card {
        padding: 1.75rem 1.5rem;
    }
    .auth-tabs {
        margin-bottom: 1.25rem;
    }
    .auth-tab-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    .auth-modal-header {
        font-size: 1.3rem;
    }
    .auth-modal-subheader {
        font-size: 0.82rem;
        margin-bottom: 1.25rem;
    }
    .custom-modal-title {
        font-size: 1.15rem;
    }
    .custom-modal-message {
        font-size: 0.82rem;
        margin-bottom: 1.15rem;
    }
    .custom-modal-close {
        top: 1rem;
        right: 1rem;
        font-size: 1.15rem;
        width: 24px;
        height: 24px;
    }

    /* Shrink form inputs and dropdowns */
    .borrow-input, .custom-select-trigger {
        padding: 0.75rem 1rem !important;
        font-size: 0.85rem !important;
        border-radius: 8px !important;
    }

    .auth-form-input {
        padding: 0.7rem 1rem 0.7rem 2.5rem !important;
        font-size: 0.88rem !important;
        border-radius: 8px !important;
    }

    .auth-form-input.password-input {
        padding-right: 2.85rem !important;
    }

    /* Shrink Custom Dropdown options */
    .custom-select-option {
        padding: 0.65rem 1rem !important;
        font-size: 0.85rem !important;
    }

    /* Shrink Library Cards Grid on mobile */
    .library-books-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    /* Shrink Library Overlays */
    .lib-book-overlay {
        padding: 1rem 0.5rem 0.75rem !important;
    }
    .lib-book-overlay-title {
        font-size: 0.9rem !important;
    }
    .lib-book-overlay-grade {
        font-size: 0.75rem !important;
    }

    /* Shrink Admin CMS forms */
    .admin-management-section {
        padding: 1.25rem !important;
        border-radius: var(--border-radius-sm) !important;
    }
    .admin-table th, .admin-table td {
        padding: 0.6rem 0.75rem !important;
        font-size: 0.8rem !important;
    }
    .admin-filter-btn {
        padding: 0.4rem 1rem !important;
        font-size: 0.75rem !important;
    }

    /* Compact Flatpickr calendar scaling on mobile */
    .flatpickr-calendar {
        transform: scale(0.82) !important;
    }
    .flatpickr-calendar.arrowTop {
        transform-origin: top center !important;
    }
    .flatpickr-calendar.arrowBottom {
        transform-origin: bottom center !important;
    }
}

@media (max-width: 480px) {
    /* Further scale down for very small screens */
    html {
        font-size: 13px;
    }
    
    .library-books-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
}


/* =========================================================================
   GLOBAL SKELETON LOADING SCREEN
   ========================================================================= */

@media (min-width: 769px) {
    .navbar-action-wrapper {
        margin-left: 1.5rem;
    }
}

/* =========================================================================
   MODERN PREMIUM TOAST NOTIFICATION SYSTEM
   ========================================================================= */

.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 16px);
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 450px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.toast-card {
    pointer-events: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 40px;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.85rem;
    position: relative;
    overflow: hidden;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast-card.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-card.hide {
    transform: scale(0.9) translateY(-10px);
    opacity: 0;
}

.toast-accent-bar {
    display: none;
}

.toast-icon-wrapper {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.toast-success .toast-icon-wrapper {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.toast-error .toast-icon-wrapper {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.toast-warning .toast-icon-wrapper {
    background-color: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.toast-info .toast-icon-wrapper {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.toast-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: left;
}

.toast-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.toast-desc {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.35;
    font-weight: 500;
}

.toast-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.95rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    outline: none;
    padding: 0;
    margin-left: 4px;
}

.toast-close-btn:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.toast-progress {
    display: none;
}

.toast-progress-bar {
    display: none;
}

@media (max-width: 576px) {
    .toast-container {
        top: calc(var(--navbar-height) + 12px);
        right: 50%;
        transform: translateX(50%);
        max-width: 92%;
        width: 100%;
    }
    
    .toast-card {
        transform: translateY(-30px);
        grid-template-columns: auto 1fr auto;
        padding: 0.65rem 1.25rem;
        gap: 0.75rem;
        border-radius: 30px;
    }
    
    .toast-card.show {
        transform: translateY(0);
    }
    
    .toast-card.hide {
        transform: scale(0.9) translateY(-10px);
    }
}

/* =========================================================================
   SIDEBAR LAYOUT SYSTEM (GAYA PERPUSNAS)
   ========================================================================= */

:root {
    --sidebar-width: 280px;
    --sidebar-bg: #0f172a; /* Deep Slate Navy */
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --sidebar-active-bg: #1e3a8a;
    --sidebar-active-text: #ffffff;
    --sidebar-border: #1e293b;
    --header-height: 70px;
}

body {
    background-color: #f8fafc;
    overflow-x: hidden;
}

/* Base grid layout */
.app-sidebar-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Left sidebar styles */
.sidebar-nav {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1010;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand .logo-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--white);
}

.sidebar-brand .logo-brand img {
    height: 40px;
    width: 40px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background-color: #ffffff;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    font-size: 1.15rem;
    font-weight: 850;
    color: var(--white);
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu-list {
    flex: 1;
    padding: 1.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
}

.sidebar-menu-list::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

/* Sidebar Menu Section Titles */
.sidebar-menu-section-title {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 1.25px;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding: 0 1.15rem;
    font-family: var(--font-heading);
}

.sidebar-menu-section-title:first-of-type {
    margin-top: 0;
}

/* Sidebar Dropdown arrow and sub-links styling */
.dropdown-arrow.open {
    transform: rotate(180deg);
}

.sidebar-dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    color: var(--sidebar-text);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: var(--transition);
}

.sidebar-dropdown-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--white);
}

.sidebar-dropdown-link.active {
    color: var(--white);
    font-weight: 700;
}

/* Sidebar Links */
.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.15rem;
    color: var(--sidebar-text);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 12px;
    transition: var(--transition);
    position: relative;
}

.sidebar-menu-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: var(--transition);
}

.sidebar-menu-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--white);
}

.sidebar-menu-link:hover i {
    color: var(--white);
}

.sidebar-menu-link.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.25);
}

.sidebar-menu-link.active i {
    color: var(--white);
}

/* ── Sidebar Custom Tooltip (Global Fixed - tidak bisa ter-clip) ── */
#sidebar-global-tooltip {
    position: fixed;
    background: #0f172a;
    color: #f8fafc;
    padding: 0.35rem 0.9rem;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 600;
    font-family: var(--font-heading);
    white-space: nowrap;
    pointer-events: none;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    letter-spacing: 0.01em;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

#sidebar-global-tooltip.visible {
    opacity: 1;
    transform: translateX(0);
}

#sidebar-global-tooltip::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #0f172a;
}

/* Badge count inside link */
.sidebar-badge {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    color: var(--white);
}

/* Sidebar footer profile box */
.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-profile-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--sidebar-hover);
    padding: 0.85rem;
    border-radius: 12px;
    position: relative;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--sidebar-active-bg);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.profile-details {
    flex: 1;
    min-width: 0;
}

.profile-name {
    color: var(--white);
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-role {
    color: #64748b;
    font-weight: 600;
    font-size: 0.75rem;
}

.sidebar-logout-btn {
    color: #ef4444;
    font-size: 1.05rem;
    transition: var(--transition);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logout-btn:hover {
    color: #f87171;
    transform: translateX(2px);
}

/* Right main workspace layout */
.main-workspace {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--transition);
    position: relative;
}

/* Global Faint & Blurred Logo Watermark Background */
.workspace-body-container::before {
    content: '';
    position: fixed;
    top: 54%;
    left: calc(var(--sidebar-width) + (100% - var(--sidebar-width)) / 2);
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 460px;
    height: 460px;
    background-image: url('../picture/logo_bg.jpg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.05; /* Faint watermark */
    filter: blur(1.5px); /* Soft blur */
    pointer-events: none;
    z-index: 0;
    transition: left var(--transition) ease;
}

/* Adjust watermark positioning when sidebar is collapsed */
body.sidebar-collapsed .workspace-body-container::before {
    left: calc(60px + (100% - 60px) / 2);
}

@media (max-width: 768px) {
    .workspace-body-container::before {
        left: 50% !important;
    }
}

/* Header bar */
.workspace-header {
    height: var(--header-height);
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.25rem;
    position: sticky;
    top: 0;
    z-index: 990;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.01);
}

.workspace-header .sidebar-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 22px;
    height: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    outline: none;
    padding: 0;
}

.workspace-header .sidebar-toggle span {
    width: 100%;
    height: 2px;
    background-color: var(--dark-color);
    border-radius: 2px;
    transition: var(--transition);
}

.student-grade-badge {
    background-color: var(--primary-light);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: var(--font-heading);
    border: 1px solid rgba(30, 58, 138, 0.08);
}

/* Workspace body wrapper and content area */
.workspace-body-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2.25rem;
    gap: 2.25rem;
    background-color: #f8fafc;
    position: relative;
}

.main-content-area {
    flex: 1;
    position: relative;
    z-index: 1;
}

.workspace-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

/* Hide standard top navbar styling to prevent double headers */
.navbar-header {
    display: none !important;
}

/* =========================================================================
   RESPONSIVE SIDEBAR BREAKPOINTS
   ========================================================================= */

@media (max-width: 992px) {
    .sidebar-nav {
        left: calc(-1 * var(--sidebar-width));
    }
    
    .sidebar-nav.active {
        left: 0;
        box-shadow: 10px 0 30px rgba(15, 23, 42, 0.15);
    }
    
    .main-workspace {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .workspace-header {
        padding: 0 1.5rem;
    }
    
    .workspace-header .sidebar-toggle {
        display: flex;
    }
    
    .workspace-body-container {
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    /* Overlay background when sidebar slides out on mobile */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(15, 23, 42, 0.3);
        backdrop-filter: blur(4px);
        z-index: 1005;
        opacity: 0;
        pointer-events: none;
        transition: var(--transition);
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Desktop Collapsed Sidebar States (Mini Sidebar) */
@media (min-width: 993px) {
    body.sidebar-collapsed {
        --sidebar-width: 80px;
    }
    body.sidebar-collapsed .sidebar-nav {
        width: 80px;
        left: 0;
    }
    body.sidebar-collapsed .main-workspace {
        margin-left: 80px;
        width: calc(100% - 80px);
        max-width: calc(100% - 80px);
    }
    
    /* Center Brand Logo in collapsed state */
    body.sidebar-collapsed .sidebar-brand {
        padding: 0;
        justify-content: center;
    }
    body.sidebar-collapsed .sidebar-brand .brand-text {
        display: none;
    }
    body.sidebar-collapsed .logo-brand {
        justify-content: center;
        gap: 0;
        margin: 0;
        width: 100%;
        display: flex;
    }

    /* Hide section titles in menu list */
    body.sidebar-collapsed .sidebar-menu-section-title {
        display: none;
    }
    
    /* Center and format menu links */
    body.sidebar-collapsed .sidebar-menu-link {
        justify-content: center;
        padding: 0.85rem 0;
        margin: 0.15rem 0.5rem;
        border-radius: 12px;
    }
    body.sidebar-collapsed .sidebar-menu-link span:not(.sidebar-badge) {
        display: none;
    }
    body.sidebar-collapsed .sidebar-menu-link i.dropdown-arrow {
        display: none;
    }
    body.sidebar-collapsed .sidebar-menu-link i:first-child {
        margin: 0;
        font-size: 1.15rem;
    }
    
    /* Convert sidebar numeric badges to premium notification dots */
    body.sidebar-collapsed .sidebar-menu-link .sidebar-badge {
        position: absolute;
        top: 6px;
        right: 6px;
        margin: 0;
        padding: 0;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        font-size: 0;
        border: 2px solid var(--sidebar-bg);
        background-color: #ef4444 !important;
    }
    
    /* Format footer elements */
    body.sidebar-collapsed .sidebar-footer {
        padding: 1rem 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    body.sidebar-collapsed .sidebar-profile-box {
        padding: 0;
        background: transparent;
        flex-direction: column;
        align-items: center;
        gap: 0.50rem;
        width: 100%;
    }
    body.sidebar-collapsed .profile-details {
        display: none;
    }
    body.sidebar-collapsed .sidebar-logout-btn {
        margin: 0;
        padding: 0;
        background-color: rgba(239, 68, 68, 0.1);
        color: #ef4444;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: var(--transition);
    }
    body.sidebar-collapsed .sidebar-logout-btn:hover {
        background-color: rgba(239, 68, 68, 0.2);
        color: #f87171;
        transform: scale(1.05);
    }
    body.sidebar-collapsed .sidebar-login-btn {
        padding: 0 !important;
        border-radius: 12px !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 auto !important;
    }
    body.sidebar-collapsed .sidebar-login-btn span {
        display: none;
    }
    body.sidebar-collapsed .sidebar-login-btn i {
        margin: 0 !important;
        font-size: 1.1rem;
    }
}

/* =========================================================================
   LIGHTWEIGHT PJAX SPA NAVIGATION STYLES
   ========================================================================= */

/* YouTube-style premium top progress bar */
#pjax-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5), 0 0 5px rgba(37, 99, 235, 0.3);
    z-index: 99999;
    width: 0%;
    transition: width 0.3s cubic-bezier(0.1, 0.8, 0.1, 1), opacity 0.3s ease;
    pointer-events: none;
    opacity: 0;
}

#pjax-progress-bar.active {
    opacity: 1;
}

/* Dim layout when content is loading */
.main-workspace {
    transition: opacity 0.25s ease;
}

.main-workspace.pjax-loading {
    opacity: 0.55;
    pointer-events: none;
}


