/* ============================================
   CSS Variables & Theme System
   ============================================ */
:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: white;
    --bg-sidebar: #1a1a1a;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-primary: #333;
    --text-secondary: #666;
    --text-tertiary: #999;
    --border-color: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.3);
    --error-bg: #fee;
    --error-text: #c33;
    --success-bg: #efe;
    --success-text: #3c3;
    --accent-purple: #667eea;
    --accent-blue: #1976d2;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-sidebar: #0a0a0a;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --border-color: #404040;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --error-bg: #3a1f1f;
    --error-text: #ff6b6b;
    --success-bg: #1f3a1f;
    --success-text: #6bff6b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    transition: background 0.3s ease;
    color: var(--text-primary);
}

/* ============================================
   Typography
   ============================================ */
h1 {
    color: var(--text-primary);
    transition: color 0.3s ease;
}

h2 {
    color: var(--text-primary);
    transition: color 0.3s ease;
}

/* ============================================
   Theme Toggle
   ============================================ */
.theme-toggle {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px var(--shadow);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--text-primary);
    transition: fill 0.3s ease;
}

/* ============================================
   Buttons
   ============================================ */
button {
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    transition: color 0.3s ease;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: monospace;
}

input[type="text"][name="session_sid"],
input[type="text"][name="authorization"] {
    font-family: monospace;
}

.help-text {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 5px;
    transition: color 0.3s ease;
}

/* ============================================
   Messages (Error/Success)
   ============================================ */
.error {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
    transition: background 0.3s ease, color 0.3s ease;
}

.error.show {
    display: block;
}

.success {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
    transition: background 0.3s ease, color 0.3s ease;
}

.success.show {
    display: block;
}

/* ============================================
   Loading States
   ============================================ */
.loading {
    display: none;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 10px;
    transition: color 0.3s ease;
}

.loading.show {
    display: block;
}

/* ============================================
   Cards & Containers
   ============================================ */
.container {
    max-width: 800px;
    margin: 0 auto;
}

.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 20px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* ============================================
   Tabs
   ============================================ */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

/* ============================================
   Status Badges
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

.status-badge.saved {
    background: var(--success-bg);
    color: var(--success-text);
}

.status-badge.not-saved {
    background: var(--error-bg);
    color: var(--error-text);
}

/* ============================================
   Navigation
   ============================================ */
.nav-menu {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.nav-menu ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

.nav-menu a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.nav-menu a:hover {
    background: var(--bg-primary);
}

.nav-menu a.active {
    background: #667eea;
    color: white;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.header h1 {
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username {
    color: var(--text-secondary);
    font-size: 14px;
    transition: color 0.3s ease;
}

.btn-logout {
    padding: 8px 16px;
    background: var(--bg-primary);
    border: none;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease, color 0.3s ease;
    text-decoration: none;
}

.btn-logout:hover {
    background: var(--border-color);
}

/* ============================================
   Projects Page Specific Styles
   ============================================ */
.sidebar {
    width: 60px;
    background: var(--bg-sidebar);
    min-height: 100vh;
    transition: width 0.3s ease, background 0.3s ease;
    position: fixed;
    left: 0;
    top: 0;
}

.sidebar-toggle {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.main-content {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 40px;
    height: 40px;
    background: var(--accent-purple);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: color 0.3s ease;
}

.connection-badge {
    padding: 4px 12px;
    border-radius: 12px;
    background: var(--success-bg);
    color: var(--success-text);
    font-size: 12px;
    font-weight: 500;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #333;
}

/* Profile Menu */
.profile-menu-container {
    position: relative;
}

.profile-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.profile-icon-btn:hover {
    transform: scale(1.05);
}

.profile-icon-btn:focus {
    outline: 2px solid var(--accent-purple);
    outline-offset: 2px;
    border-radius: 50%;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.profile-dropdown-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
}

.profile-dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #333;
    font-size: 18px;
    flex-shrink: 0;
}

.profile-dropdown-info {
    flex: 1;
    min-width: 0;
}

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

.profile-dropdown-id {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.profile-dropdown-status {
    margin-top: 4px;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.profile-dropdown-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
}

.profile-dropdown-item:hover {
    background: var(--bg-primary);
}

.profile-dropdown-item svg {
    flex-shrink: 0;
    fill: var(--text-primary);
}

.profile-dropdown-logout {
    color: var(--error-text);
}

.profile-dropdown-logout:hover {
    background: var(--error-bg);
    color: var(--error-text);
}

.profile-dropdown-logout svg {
    fill: var(--error-text);
}

.alert-banner {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease, color 0.3s ease;
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-icon {
    width: 20px;
    height: 20px;
}

.btn-try-again {
    background: var(--error-text);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.3s;
}

.btn-try-again:hover {
    opacity: 0.8;
}

.content-area {
    padding-bottom: 60px; /* Space for fixed footer */
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.section-title-group h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    transition: color 0.3s ease;
}

.last-synced {
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 400;
    margin-left: 8px;
    transition: color 0.3s ease;
}

.section-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-buttons {
    display: flex;
    gap: 0;
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 4px;
    transition: background 0.3s ease;
}

.filter-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 2px 4px var(--shadow);
}

.btn-sync {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s;
}

.btn-sync:hover {
    opacity: 0.9;
}

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

.projects-container {
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    min-height: 400px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    opacity: 0.3;
    margin-bottom: 24px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
    transition: color 0.3s ease;
}

.project-list {
    display: grid;
    gap: 16px;
}

.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.project-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-2px);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
    gap: 16px;
}

.project-header > div:first-child {
    flex: 1;
    min-width: 0; /* Allows flex item to shrink below content size */
}

.project-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    transition: color 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.project-id {
    font-family: monospace;
    color: var(--text-secondary);
    font-size: 12px;
    transition: color 0.3s ease;
}

.project-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0; /* Prevent button from shrinking */
    white-space: nowrap; /* Prevent button text from wrapping */
    display: flex;
    align-items: center;
}

.project-link:hover {
    text-decoration: underline;
}

.project-meta {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    margin-bottom: 4px;
    transition: color 0.3s ease;
}

.meta-value {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
    transition: color 0.3s ease;
}

.hourly-rate {
    color: #27ae60;
}

.project-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 12px;
    font-size: 14px;
    transition: color 0.3s ease;
}

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease, border-color 0.3s ease;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hide-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    transition: color 0.3s ease;
}

.progress-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.blue {
    background: var(--accent-blue);
}

.status-dot.green {
    background: #27ae60;
}

.status-dot.red {
    background: #e74c3c;
}

.status-dot.orange {
    background: #f39c12;
}

.btn-reset {
    background: transparent;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: opacity 0.3s;
}

.btn-reset:hover {
    opacity: 0.8;
}

.footer-right {
    display: flex;
    gap: 24px;
    align-items: center;
}

.footer-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* ============================================
   Filter Panel
   ============================================ */
.btn-filter-settings {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.btn-filter-settings:hover {
    background: var(--bg-primary);
    border-color: var(--accent-purple);
}

.filter-panel {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px var(--shadow);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.filter-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.filter-panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close-filter {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-close-filter:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.filter-panel-content {
    padding: 24px;
}

.filter-mode-section {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    border: 2px solid var(--border-color);
}

.mode-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.mode-selector-header label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.mode-description {
    margin-top: 12px;
}

.mode-description p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.mode-description strong {
    color: var(--text-primary);
}

.filter-divider {
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

.filter-group {
    margin-bottom: 24px;
}

.filter-group:last-of-type {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.filter-input-group {
    display: flex;
    align-items: center;
    position: relative;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    z-index: 1;
}

.filter-input-group input[type="number"] {
    width: 100%;
    padding: 12px 40px 12px 28px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

.filter-input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.btn-clear-filter {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    z-index: 1;
}

.btn-clear-filter:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.filter-panel-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.filter-panel-actions .btn-primary,
.filter-panel-actions .btn-secondary {
    flex: 1;
    padding: 12px 24px;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.filter-header label {
    margin-bottom: 0;
    flex: 1;
}

.filter-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-purple);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.filter-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.filter-header-inline label {
    margin-bottom: 0;
}

.btn-clear-research-types {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-decoration: underline;
}

.btn-clear-research-types:hover {
    color: var(--text-primary);
    background: var(--bg-primary);
}

.research-type-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.research-type-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    user-select: none;
}

.research-type-option:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-purple);
}

.research-type-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-purple);
    flex-shrink: 0;
}

.research-type-option input[type="checkbox"]:checked + .option-label {
    color: var(--accent-purple);
    font-weight: 600;
}

.research-type-option:has(input[type="checkbox"]:checked) {
    background: var(--bg-secondary);
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.option-label {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease, font-weight 0.3s ease;
    flex: 1;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transition: background 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-close-modal:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    padding: 12px 24px;
}

.btn-config {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.btn-config:hover {
    background: var(--bg-primary);
    border-color: var(--accent-purple);
}

