﻿/* ==========================================
   GLOBAL RESET & TYPOGRAPHY
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f6f9;
    color: #333333;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================
   TOP NAVIGATION BAR
   ========================================== */
.top-bar {
    height: 60px;
    background-color: #ffffff;
    border-bottom: 1px solid #e3e6f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.05);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: #4e73df;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.35rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background-color: #eaecf4;
    color: #2e59d9;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-img {
    max-height: 35px;
    width: auto;
    object-fit: contain;
}

.app-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2e59d9;
    letter-spacing: -0.02em;
}

.app-version {
    font-size: 0.75rem;
    background-color: #e8ecef;
    color: #6c757d;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

/* ==========================================
   INTEGRATED LOGIN PARTIAL STYLES
   ========================================== */
.top-bar-right {
    display: flex;
    align-items: center;
}

.login-partial-container,
#loginPartial-div {
    display: flex;
    align-items: center;
}

/* Restored Utilities */
.d-flex {
    display: flex !important;
}

.align-items-center {
    align-items: center !important;
}

.gap-3 {
    gap: 1rem !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

.floatleft {
    float: left;
}

/* Badges & Text Styling */
.badge,
.user-badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.35rem;
}

.bg-secondary {
    background-color: #6c757d;
    color: #ffffff;
}

.user-badge {
    background-color: #e9ecef;
    color: #495057;
    font-weight: 500;
}

.navbar-text,
.welcome-text {
    color: #5a5c69;
    font-size: 0.875rem;
}

.username,
.username-link {
    color: #4e73df;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.username:hover,
.username-link:hover {
    color: #2e59d9;
    text-decoration: underline;
}

.auth-buttons {
    display: flex;
    align-items: center;
}

/* ==========================================
   BUTTON CONTROLS
   ========================================== */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.35rem 0.75rem;
    font-size: 0.825rem;
    border-radius: 0.35rem;
    transition: all 0.15s ease-in-out;
}

.btn-sm {
    padding: 0.25rem 0.55rem;
    font-size: 0.775rem;
}

.btn-primary {
    color: #ffffff;
    background-color: #4e73df;
    border-color: #4e73df;
}

.btn-primary:hover {
    background-color: #2e59d9;
    border-color: #2643e9;
}

.btn-outline-primary {
    color: #4e73df;
    border-color: #4e73df;
    background-color: transparent;
}

.btn-outline-primary:hover {
    color: #ffffff;
    background-color: #4e73df;
}

.btn-outline-danger {
    color: #e74a3b;
    border-color: #e74a3b;
    background-color: transparent;
}

.btn-outline-danger:hover {
    color: #ffffff;
    background-color: #e74a3b;
}

.d-inline {
    display: inline-block !important;
}

/* ==========================================
   SIDEBAR NAVIGATION
   ========================================== */
.main-wrapper {
    display: flex;
    margin-top: 60px; /* Topbar Offset */
    min-height: calc(100vh - 60px);
}

.sidebar-panel {
    width: 240px;
    background-color: #1a252f;
    color: #abb9c7;
    flex-shrink: 0;
    transition: margin-left 0.3s ease;
}

.sidebar-panel.collapsed {
    margin-left: -240px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    color: #abb9c7;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

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

.nav-icon {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
}

.arrow-icon {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.has-treeview.open .arrow-icon {
    transform: rotate(90deg);
}

.treeview-menu {
    display: none;
    background-color: #11181f;
    padding-left: 1.5rem;
}

.treeview-link {
    display: block;
    padding: 0.6rem 1rem;
    color: #8a9a86;
    text-decoration: none;
    font-size: 0.825rem;
    cursor: pointer;
    transition: color 0.15s ease;
}

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

/* ==========================================
   MAIN WORKSPACE & CONTENT AREA
   ========================================== */
.main-content-wrapper {
    flex-grow: 1;
    padding: 1.5rem;
    background-color: #f8f9fc;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    min-width: 0; /* Prevents flexbox overflow */
}

.content-body {
    flex-grow: 1;
}

/* Restored UI Cards & Form Field Container Defaults */
.card-container {
    background: #ffffff;
    border: 1px solid #e3e6f0;
    border-radius: 0.35rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.05);
}

.card-header-title {
    font-size: 1rem;
    font-weight: 700;
    color: #4e73df;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e3e6f0;
    padding-bottom: 0.5rem;
}

/* Restored Table & Grid System Styling Overrides */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.custom-grid-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.custom-grid-table th {
    background-color: #f8f9fc;
    color: #4e73df;
    font-weight: 700;
    border-bottom: 2px solid #e3e6f0;
    padding: 0.75rem;
    text-align: left;
}

.custom-grid-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e3e6f0;
    vertical-align: middle;
}

.custom-grid-table tr:hover {
    background-color: #f1f3f9;
}

/* ==========================================
   FOOTER STYLES
   ========================================== */
.app-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e3e6f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #858796;
}

.footer-links a {
    color: #858796;
    text-decoration: none;
    margin-right: 1rem;
}

.footer-links a:hover {
    color: #4e73df;
}

/* ==========================================
   LOADING OVERLAY & UTILITIES
   ========================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.85);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #4e73df;
}

.error-banner {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 0.75rem 1.25rem;
    border-radius: 0.35rem;
    margin-bottom: 1rem;
}

.displaynone {
    display: none !important;
}

/* ==========================================
   RESTORED RESPONSIVE MEDIA QUERIES
   ========================================== */
@media (max-width: 768px) {
    .top-bar {
        padding: 0 0.75rem;
    }

    .app-title {
        display: none; /* Hide full title on small screens */
    }

    .welcome-text {
        display: none; /* Hide long user greeting on narrow viewports */
    }

    #sidebar.sidebar-panel {
        position: fixed;
        top: 60px;
        bottom: 0;
        left: -240px;
        width: 240px;
        z-index: 1040;
        transition: left 0.3s ease-in-out;
    }

    /* When Bootstrap 'show' class is added via click */
    #sidebar.sidebar-panel.show {
        left: 0;
    }
     
    .main-content-wrapper {
        padding: 1rem;
    }

    .app-footer {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .footer-links a {
        margin: 0 0.5rem;
    }
}



/* ==========================================
   TOPBAR LOGIN PARTIAL COMPONENT
   ========================================== */
.topbar-login-wrapper {
    display: flex;
    align-items: center;
}

.topbar-auth-container,
.topbar-guest-container {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

/* Online Status Pill */
.online-status-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background-color: #f1f3f9;
    color: #495057;
    padding: 0.3rem 0.65rem;
    border-radius: 50rem;
    font-size: 0.775rem;
    font-weight: 600;
    border: 1px solid #e3e6f0;
}

.status-dot {
    width: 7px;
    height: 7px;
    background-color: #1cc88a;
    border-radius: 50%;
    display: inline-block;
}

/* User Profile Dropdown */
.user-profile-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 0.35rem;
    transition: background-color 0.2s ease;
}

.user-dropdown-btn:hover {
    background-color: #f8f9fc;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #4e73df;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.user-display-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #4e73df;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-arrow {
    font-size: 0.7rem;
    color: #858796;
    transition: transform 0.2s ease;
}

/* Dropdown Menu Overlay */
.dropdown-menu-custom {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    width: 200px;
    background-color: #ffffff;
    border: 1px solid #e3e6f0;
    border-radius: 0.35rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1050;
    padding: 0.5rem 0;
}

.dropdown-menu-custom.show {
    display: block;
}

.dropdown-header {
    padding: 0.5rem 1rem;
    font-size: 0.775rem;
    color: #858796;
}

.dropdown-header-user {
    display: block;
    color: #333333;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-divider {
    height: 0;
    margin: 0.4rem 0;
    overflow: hidden;
    border-top: 1px solid #e3e6f0;
}

.dropdown-item-custom {
    display: block;
    width: 100%;
    padding: 0.45rem 1rem;
    clear: both;
    font-weight: 400;
    color: #3a3b45;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    font-size: 0.825rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dropdown-item-custom:hover {
    background-color: #f8f9fc;
    color: #4e73df;
}

.logout-item {
    color: #e74a3b;
}

.logout-item:hover {
    background-color: #fdf2f2;
    color: #e74a3b;
}

.guest-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}



/* ==========================================
   MODERN 3-LINE HAMBURGER TOGGLE BUTTON
   ========================================== */
.sidebar-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.sidebar-toggle-btn:hover {
    background-color: #eaecf4;
}

.sidebar-toggle-btn:active {
    transform: scale(0.95);
}

/* Hamburger Container */
.hamburger-icon {
    width: 20px;
    height: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

/* Individual Lines */
.hamburger-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #4e73df;
    border-radius: 2px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left center;
}

/* Middle Line Styling for Modern Asymmetry (Optional Polish) */
.sidebar-toggle-btn:hover .hamburger-icon span:nth-child(2) {
    width: 75%;
}

/* ==========================================
   ANIMATED STATES WHEN SIDEBAR IS COLLAPSED
   ========================================== */
/* Optional: Animate lines into a compact state when collapsed */
.sidebar-panel.collapsed + .main-content-wrapper .hamburger-icon span:nth-child(1),
body.sidebar-collapsed .hamburger-icon span:nth-child(1) {
    width: 100%;
}

body.sidebar-collapsed .hamburger-icon span:nth-child(2) {
    width: 100%;
}


/* ==========================================
   SIDEBAR NAVIGATION
   ========================================== */
.main-wrapper {
    display: flex;
    margin-top: 60px; /* Topbar Offset */
    min-height: calc(100vh - 60px);
}

.sidebar-panel {
    width: 240px;
    background-color: #1a252f;
    color: #abb9c7;
    flex-shrink: 0;
    transition: margin-left 0.3s ease;
    
    /* FIX: Sticky Positioning & Independent Scrolling */
    position: sticky;
    top: 60px; /* Offset below topbar */
    height: calc(100vh - 60px); /* Full height of viewable screen */
    overflow-y: auto; /* Scroll internally if sidebar items exceed view height */
}

.sidebar-panel.collapsed {
    margin-left: -240px;
}

/* Optional: Clean scrollbar for the sidebar */
.sidebar-panel::-webkit-scrollbar {
    width: 6px;
}
.sidebar-panel::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ==========================================
   MAIN WORKSPACE & CONTENT AREA
   ========================================== */
.main-content-wrapper {
    flex-grow: 1;
    padding: 1.5rem;
    background-color: #f8f9fc;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    min-width: 0; /* Prevents flexbox overflow */
    
    /* Ensure main content handles vertical page overflow */
    min-height: calc(100vh - 60px);
}































