/* Layout Essentials */
:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --topbar-height: 72px;
}

#app {
    min-height: 100vh;
    background: var(--bg-main);
    display: flex;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.sidebar-header h2 {
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    letter-spacing: -0.02em;
}

.nav-links {
    list-style: none;
    padding: 1.5rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 0.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link i {
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary);
}

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

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.nav-link.active i {
    color: white;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-details-mobile-hide {
    display: none;
}
@media (min-width: 640px) {
    .user-details-mobile-hide {
        display: block;
    }
}

.avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.content-wrapper {
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    min-width: 0;
    margin: 0 auto;
}

/* Authentication Pages */
.auth-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    background: var(--bg-main);
}

.auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    width: 100%;
}

.auth-visual-side {
    flex: 1.2;
    display: none;
    background: radial-gradient(circle at bottom right, var(--primary-dark) 0%, var(--primary) 100%);
    position: relative;
    overflow: hidden;
    color: white;
    padding: 4rem;
}

@media (min-width: 1024px) {
    .auth-visual-side {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .auth-form-side {
        max-width: 50%;
    }
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 2rem !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.auth-header {
    text-align: left;
    margin-bottom: 3rem;
}

.auth-header h1 {
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    font-weight: 500;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal {
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    margin: 1rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
}

.modal-header h3 {
    font-size: 1.25rem;
    margin: 0;
}

.modal-close {
    background: var(--bg-main);
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #FEE2E2;
    color: var(--accent);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0,0,0,0.2);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.5rem;
        cursor: pointer;
    }
}

@media (min-width: 1025px) {
    .mobile-menu-btn {
        display: none;
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 0 1rem;
        height: 64px;
    }
    
    #topbar-title {
        font-size: 1rem;
    }

    .user-info .avatar {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .modal {
        width: calc(100% - 1.5rem);
        max-height: calc(100vh - 1.5rem);
        margin: 0.75rem;
        border-radius: var(--radius-lg);
    }

    .modal-body {
        padding: 1.5rem 1.25rem;
    }
}

/* Fix for horizontal table scroll indicators */
.table-container::after {
    content: '';
    display: block;
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 20px;
    background: linear-gradient(to right, transparent, var(--bg-card));
    pointer-events: none;
    opacity: 0;
}

@media (max-width: 768px) {
    .table-container {
        position: relative;
    }
    .table-container::after {
        opacity: 0.5;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 998;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}
