/* Header Styles */
.app-header {
    background: linear-gradient(135deg, #041631 0%, #1654b3 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
    padding: 0.5rem 1rem;
    gap: 1rem;
}

/* Logo and Brand */
.header-brand {
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
    transition: opacity 0.2s ease;
    padding: 0.5rem 0;
}

.brand-link:hover {
    opacity: 0.9;
}

.brand-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: white;
}

/* Spacer */
.header-spacer {
    flex: 1;
}

/* Auth Section */
.header-auth {
    flex-shrink: 0;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-greeting {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.125rem;
}

.user-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
    color: rgba(255, 255, 255, 0.9);
}

.user-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Auth Buttons */
.btn-login,
.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-login {
    background-color: white;
    color: #1654b3;
}

.btn-login:hover {
    background-color: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-logout {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-login i,
.btn-logout i {
    font-size: 1rem;
}

/* Auth Checking State */
.auth-checking {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-size: 0.9rem;
}

/* Layout Styles */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #fafbfc;
}

.app-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar - Light and Clean */
.sidebar {
    width: 200px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    border-right: 1px solid #bcc8d9;
    overflow-y: auto;
    box-shadow: 0 2px 12px rgba(4, 22, 49, 0.08);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 0;
    height: 100%;
    overflow-y: auto;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.nav-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid #bcc8d9;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f6fb 100%);
}

.nav-header h5 {
    margin: 0;
    font-size: 0.775rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    color: #64748b;
}

.nav-list {
    list-style: none;
    padding: 0.75rem 0;
    margin: 0;
}

.nav-item {
    margin: 0.125rem 0;
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.5rem;
    color: #475569;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    border-radius: 0 0.5rem 0.5rem 0;
    margin-right: 0.75rem;
    position: relative;
    font-weight: 500;
    font-size: 0.925rem;
    background-color: transparent;
}

.nav-link:hover {
    color: #1654b3;
    background: linear-gradient(135deg, #f0f6ff 0%, #e6f1ff 100%);
    border-left-color: #93c5fd;
    padding-left: 1.75rem;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(22, 84, 179, 0.12);
}

.nav-link.active {
    color: #1654b3;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left-color: #1654b3;
    font-weight: 600;
    padding-left: 1.75rem;
    box-shadow: 0 2px 12px rgba(22, 84, 179, 0.15);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: linear-gradient(135deg, #1654b3 0%, #3b82f6 100%);
    border-radius: 3px 0 0 3px;
}

.nav-link i {
    font-size: 1.125rem;
    width: 1.375rem;
    text-align: center;
    opacity: 0.8;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover i {
    opacity: 1;
    transform: scale(1.1);
    color: #1654b3;
}

.nav-link.active i {
    opacity: 1;
    color: #1654b3;
}

.nav-link span {
    font-size: 0.925rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: inherit;
}

/* Custom scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #94a3b8, #64748b);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: #fafbfc;
}

.page-container {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Smooth transitions and animations */
@media (prefers-reduced-motion: no-preference) {
    .nav-link {
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-link i {
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .app-wrapper {
        background-color: #d7d7d7;
    }

    .sidebar {
        background: linear-gradient(180deg, #bfbfbf 0%, #8fa0b9 100%);
        border-right-color: #acc0e1;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }

    .sidebar-nav {
        background: linear-gradient(180deg, #bfbfbf 0%, #8fa0b9 100%);
    }

    .nav-header {
        border-bottom-color: #374151;
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    }

    .nav-header h5 {
        color: #9ca3af;
    }

    .nav-link {
        color: #d1d5db;
    }

    .nav-link:hover {
        background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
        color: #dbeafe;
        border-left-color: #3b82f6;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    }

    .nav-link.active {
        background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
        color: #dbeafe;
        border-left-color: #3b82f6;
        box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
    }

    .nav-link:hover i,
    .nav-link.active i {
        color: #dbeafe;
    }

    .main-content {
        background-color: #dbdbdb;
    }

    .sidebar-nav::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, #4b5563, #6b7280);
    }

    .sidebar-nav::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, #6b7280, #9ca3af);
    }
}

/* Responsive Design */
@media (max-width: 992px) {
    .sidebar {
        width: 180px;
    }

    .nav-link span {
        display: inline;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .sidebar {
        width: 160px;
    }

    .nav-header {
        padding: 1rem 1rem 0.75rem 1rem;
    }

    .nav-header h5 {
        font-size: 0.75rem;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        gap: 0.625rem;
        margin-right: 0.5rem;
    }

    .nav-link i {
        font-size: 1rem;
        width: 1rem;
    }

    .nav-link:hover,
    .nav-link.active {
        padding-left: 1.375rem;
    }

    .nav-link span {
        font-size: 0.85rem;
    }

    .page-container {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .header-container {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .brand-logo {
        height: 28px;
    }

    .brand-name {
        display: none;
    }

    .user-greeting {
        display: none;
    }

    .sidebar {
        width: 60px;
    }

    .nav-header {
        display: none;
    }

    .nav-list {
        padding: 0.5rem 0;
    }

    .nav-item {
        margin: 0.25rem 0;
    }

    .nav-link {
        padding: 0.875rem 0.75rem;
        font-size: 0.8rem;
        gap: 0;
        margin-right: 0.25rem;
        justify-content: center;
        border-radius: 0.375rem;
    }

    .nav-link i {
        font-size: 1.125rem;
        width: auto;
    }

    .nav-link span {
        display: none;
    }

    .nav-link:hover,
    .nav-link.active {
        padding-left: 0.75rem;
    }

    .nav-link.active::after {
        display: none;
    }

    .page-container {
        padding: 1rem;
    }
}