
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #246BFD;
    --primary-dark: #1a5fd9;
    --primary-light: #E3F2FD;
    --secondary: #1A1A1A;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7F7F7;
    --bg-tertiary: #FAFAFA;
    --border: #E0E0E0;
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #F44336;
    --error-dark: #D32F2F;
    --error-light: #FFEBEE;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navigation - Modern Professional Design */
.nav {
    background: var(--primary);
    color: white;
    padding: 0 20px;
    height: 72px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-logo-link {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.nav-logo-link:hover {
    opacity: 0.85;
}

.nav-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.nav-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.8px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.nav-title:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.nav-menu {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px;
    border-radius: 14px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-user {
    display: flex;
    align-items: center;
    position: absolute;
    right: 40px;
}

.user-avatar-container {
    position: relative;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.user-avatar:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.user-avatar:active {
    transform: scale(0.95);
}

.user-avatar span {
    color: white;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
}

/* User Menu Dropdown */
.user-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 240px;
    z-index: 1000;
    animation: slideDown 0.2s ease;
    overflow: hidden;
    border: 1px solid var(--border);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-menu-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
}

.user-menu-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-menu-avatar span {
    color: white;
    font-weight: 600;
    font-size: 18px;
    text-transform: uppercase;
}

.user-menu-info {
    flex: 1;
    min-width: 0;
}

.user-menu-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-id {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
}

.user-menu-item {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.user-menu-item:hover {
    background: var(--bg-tertiary);
}

.user-menu-item.logout-btn {
    color: var(--error);
}

.user-menu-item.logout-btn:hover {
    background: var(--error-light);
    color: var(--error-dark);
}

.user-menu-item span {
    flex: 1;
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 72px);
}

/* Sidebar */
.sidebar {
    width: 360px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.sidebar-search {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-tertiary);
    transition: all 0.2s;
}

.sidebar-search:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(36, 107, 253, 0.1);
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

.delete-all-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-all-btn:hover {
    background: var(--error-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.delete-all-btn:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.new-chat-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.chat-item {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
    position: relative;
}

.chat-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
}

.chat-item.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

.chat-item-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-item-time {
    font-size: 11px;
    color: var(--text-tertiary);
}

.chat-item-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.chat-item:hover .chat-item-delete {
    display: flex;
}

.chat-item-delete:hover {
    background: var(--error-light);
    color: var(--error);
}

.doc-item {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.doc-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
}

.doc-item.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

.doc-name {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.doc-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.doc-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Content Area */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-secondary);
}

/* Screen Styles */
.screen {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Admin screen - full width with padding on content */
#adminScreen {
    padding: 0 !important;
}

#adminScreen .screen-header {
    padding: 32px 40px !important;
    margin: 30px 0px 0px !important;
}

#adminScreen > div:first-of-type {
    padding: 0 40px 40px 40px !important;
}
