/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-sidebar: #2c3e50;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-sidebar: #ecf0f1;
    --border-color: #dee2e6;
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --transition-speed: 0.3s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 70px;
    height: 100vh;
    background-color: var(--bg-sidebar);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transition: width var(--transition-speed);
}

.sidebar:hover {
    width: 200px;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.brand-icon {
    width: 32px;
    height: 32px;
    color: var(--text-sidebar);
    display: inline-block;
}

/* Navigation Items */
.nav-items {
    list-style: none;
    padding: 5px 0;
    margin: 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--text-sidebar);
    text-decoration: none;
    transition: background-color var(--transition-speed);
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background-color: var(--accent-color);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background-color: #fff;
}

.nav-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    color: currentColor;
}

.nav-label {
    margin-left: 15px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.sidebar:hover .nav-label {
    opacity: 1;
}

/* Sidebar Bottom Controls */
.sidebar-bottom {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    flex-shrink: 0;
}

/* Sidebar scrollbar styling */
.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theme-toggle {
    width: 100%;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: var(--text-sidebar);
    cursor: pointer;
    transition: background-color var(--transition-speed);
    display: flex;
    justify-content: center;
    align-items: center;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.theme-icon-light,
.theme-icon-dark {
    width: 20px;
    height: 20px;
}

.theme-icon-dark {
    display: none;
}

/* Bottom Navigation (Mobile Only) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    z-index: 999;
    padding: 0 0 env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: color var(--transition-speed);
    position: relative;
    min-height: 56px;
    box-sizing: border-box;
}

.bottom-nav-item:hover {
    color: var(--accent-color);
}

.bottom-nav-item.active {
    color: var(--accent-color);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 0 0 2px 2px;
}

.bottom-nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
}

.bottom-nav-label {
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    text-align: center;
}

/* Main Content Area */
.main-content {
    margin-left: 70px;
    min-height: 100vh;
    background-color: var(--bg-primary);
    transition: margin-left var(--transition-speed);
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

/* Page Header */
.page-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.card h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.card p {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #5a6268;
}

/* User Info in Sidebar */
.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
    transition: all var(--transition-speed);
}

.username {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-speed);
    text-decoration: none;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.logout-btn svg {
    width: 16px;
    height: 16px;
}

/* Hide username text when sidebar is collapsed */
.sidebar:not(:hover) .username {
    display: none;
}

.sidebar:not(:hover) .user-info {
    justify-content: center;
}

/* Profile Selector */
.profile-selector {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    flex-shrink: 0;
}

.profile-selector-current {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.profile-selector-current:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.profile-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
    overflow: hidden;
}

.profile-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    color: var(--text-sidebar);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.sidebar:hover .profile-name {
    opacity: 1;
}

.dropdown-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-sidebar);
    margin-left: auto;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.sidebar:hover .dropdown-arrow {
    opacity: 1;
}

.profile-dropdown {
    display: none;
    position: absolute;
    left: 10px;
    right: 10px;
    top: 100%;
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1001;
    overflow: hidden;
}

.profile-dropdown.show {
    display: block;
}

.profile-option-form {
    margin: 0;
}

.profile-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--transition-speed);
    text-decoration: none;
}

.profile-option:hover {
    background-color: var(--bg-secondary);
}

.profile-option.active {
    background-color: var(--accent-color);
    color: white;
}

.profile-indicator {
    font-size: 1rem;
}

.profile-manage {
    border-top: 1px solid var(--border-color);
    color: var(--accent-color);
}

.profile-selector-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    color: var(--text-sidebar);
    text-decoration: none;
    opacity: 0.7;
}

.profile-selector-empty:hover {
    opacity: 1;
}

.profile-selector-empty small {
    font-size: 0.75rem;
}

/* Navigation Sections */
.nav-section {
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.nav-section:last-of-type {
    border-bottom: none;
}

.nav-section-label {
    display: block;
    padding: 5px 20px 2px;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.sidebar:hover .nav-section-label {
    opacity: 1;
}

.nav-section .nav-items {
    padding: 2px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Hide sidebar on mobile */
    .sidebar {
        display: none;
    }

    /* Show bottom navigation on mobile */
    .bottom-nav {
        display: flex;
    }

    /* Adjust main content for mobile */
    .main-content {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 15px 15px calc(15px + 85px + env(safe-area-inset-bottom, 0));
    }

    .page-header h1 {
        font-size: 1.5rem;
    }
}
