/* ============================================
   OSMAGIC Task Manager - Dark Theme
   A distinctive, immersive GPS trace editor
   ============================================ */

/* ============================================
   THEME: Light Mode - Ocean Breeze
   ============================================ */
:root, [data-theme="light"] {
    /* Color Palette - Ocean Breeze */
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --bg-elevated: #ffffff;
    
    /* Accent Colors */
    --accent-primary: #0ea5e9;
    --accent-secondary: #06b6d4;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-success: #10b981;
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Border Colors */
    --border-primary: #e2e8f0;
    --border-focus: var(--accent-primary);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.14);
    --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.15);
    
    /* Logo colors for light theme */
    --logo-pin: #0ea5e9;
    --logo-pin-inner: #f8fafc;
    --logo-gradient-start: #0ea5e9;
    --logo-gradient-end: #06b6d4;
}

/* ============================================
   THEME: Dark Mode - Warm Mocha
   ============================================ */
[data-theme="dark"] {
    /* Color Palette - Warm Mocha */
    --bg-primary: #1c1917;
    --bg-secondary: #292524;
    --bg-tertiary: #44403c;
    --bg-elevated: #57534e;
    
    /* Accent Colors */
    --accent-primary: #d97706;
    --accent-secondary: #fbbf24;
    --accent-warning: #f59e0b;
    --accent-danger: #dc2626;
    --accent-success: #16a34a;
    
    /* Text Colors */
    --text-primary: #fafaf9;
    --text-secondary: #d6d3d1;
    --text-muted: #a8a29e;
    
    /* Border Colors */
    --border-primary: #44403c;
    --border-focus: var(--accent-primary);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(217, 119, 6, 0.2);
    
    /* Logo colors for dark theme */
    --logo-pin: #d97706;
    --logo-pin-inner: #1c1917;
    --logo-gradient-start: #d97706;
    --logo-gradient-end: #fbbf24;
}

/* Shared Variables (both themes) */
:root {
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    /* Spacing */
    --sidebar-width: 280px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

/* ============================================
   Theme Toggle Button
   ============================================ */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.theme-toggle:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.theme-toggle:hover .theme-icon {
    color: white;
}

.theme-icon {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: absolute;
}

/* Light mode: show sun, hide moon */
:root .sun-icon,
[data-theme="light"] .sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

:root .moon-icon,
[data-theme="light"] .moon-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

/* Dark mode: show moon, hide sun */
[data-theme="dark"] .sun-icon {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* ============================================
   Logo SVG Dynamic Colors
   ============================================ */
.logo-pin {
    fill: var(--logo-pin);
}

.logo-pin-inner {
    fill: var(--logo-pin-inner);
}

.gradient-start {
    stop-color: var(--logo-gradient-start);
}

.gradient-end {
    stop-color: var(--logo-gradient-end);
}

/* Smooth theme transition for all elements */
body,
.sidebar,
.main-content,
.modal-content,
.control-btn,
.nav-btn,
.filter-tab,
.stat-card,
.upload-zone,
.workflow-step,
.tag-editor {
    transition: background-color var(--transition-normal), 
                color var(--transition-normal), 
                border-color var(--transition-normal);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    color: var(--accent-primary);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.version-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    padding: 3px 8px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    color: var(--text-muted);
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-primary);
}

.section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Upload Zone */
.upload-zone {
    position: relative;
}

.upload-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    border: 2px dashed var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
}

.upload-zone:hover .upload-label,
.upload-zone:focus-within .upload-label {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 170, 0.05);
    box-shadow: var(--shadow-glow);
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-primary);
    margin-bottom: 10px;
}

.upload-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-formats {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-status {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
    border: 1px solid var(--border-primary);
    transition: all var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-active .stat-value { color: var(--accent-secondary); }
.stat-done .stat-value { color: var(--accent-success); }
.stat-skipped .stat-value { color: var(--accent-warning); }

/* Filter Tabs */
.filter-tabs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

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

.filter-tab.active {
    background: rgba(0, 212, 170, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.tab-icon {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Keep old tab-btn class for JavaScript compatibility */
.tab-btn {
    display: none;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid var(--border-primary);
}

.btn-danger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--accent-danger);
    border-radius: var(--radius-sm);
    color: var(--accent-danger);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.task-counter {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    color: var(--text-secondary);
}

.header-controls {
    display: flex;
    gap: 10px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

/* Task Display */
.task-display {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    text-align: center;
    padding: 40px;
}

.empty-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 24px;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-icon svg {
    width: 100%;
    height: 100%;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-text {
    font-size: 1rem;
    color: var(--text-muted);
}

/* Task Card */
.task-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.task-id {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-primary);
}

.task-id-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.task-id-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.task-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.detail-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-section {
    margin-bottom: 24px;
}

.status-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.status-dropdown {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239aa0a6' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.status-dropdown:hover,
.status-dropdown:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 140px;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-export:hover {
    background: #00eabc;
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.4);
    transform: translateY(-2px);
}

.btn-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
}

.btn-preview:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-secondary);
}

/* ============================================
   ALL TASKS LIST VIEW
   ============================================ */
.all-tasks-list {
    padding: 0;
}

.all-tasks-list h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.sequence-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding: 4px;
}

.sequence-id-item {
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    transition: all var(--transition-fast);
}

.sequence-id-item.clickable {
    cursor: pointer;
}

.sequence-id-item.clickable:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Simple List View (Done/Skipped) */
.simple-list-view {
    padding: 0;
}

.simple-list-view h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.sequence-list-with-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.sequence-item-with-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sequence-item-with-status:hover {
    background: var(--bg-elevated);
}

.sequence-item-with-status.highlighted {
    background: rgba(0, 212, 170, 0.1);
    border-color: var(--accent-primary);
}

.sequence-id-display {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.status-dropdown-inline {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 140px;
}

/* Search Input */
.search-input {
    width: 100%;
    padding: 12px 16px;
    padding-left: 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 20, 0.9);
    backdrop-filter: blur(8px);
    z-index: 1000;
    overflow: auto;
    padding: 20px;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 1600px;
    height: calc(100vh - 40px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-sequence-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--accent-primary);
}

.modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-elevated);
    color: var(--accent-danger);
}

.modal-body {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Workflow Panel */
.workflow-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.workflow-steps {
    display: flex;
    align-items: center;
    gap: 0;
}

.workflow-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.workflow-step.active {
    background: rgba(0, 212, 170, 0.1);
}

.workflow-step.completed .step-indicator {
    background: var(--accent-success);
}

.workflow-step.completed .step-number {
    display: none;
}

.workflow-step.completed .step-check {
    display: flex;
}

.step-indicator {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.workflow-step.active .step-indicator {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.step-check {
    display: none;
}

.step-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.step-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.step-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.step-connector {
    flex: 1;
    height: 2px;
    background: var(--border-primary);
    margin: 0 8px;
    max-width: 60px;
}

.step-action {
    padding: 6px 14px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--bg-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-left: auto;
}

.step-action:hover:not(:disabled) {
    background: #00eabc;
}

.step-action:disabled {
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Workflow action buttons */
.step-action-btn {
    padding: 6px 14px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--bg-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-left: auto;
}

.step-action-btn:hover:not(:disabled) {
    background: #00eabc;
    transform: translateY(-1px);
}

.step-action-btn:disabled {
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Step status indicator */
.step-status {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--accent-success);
    flex-shrink: 0;
    font-size: 0.9rem;
}

/* Preview Map */
.preview-map {
    flex: 1;
    min-height: 500px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

#previewMap {
    width: 100% !important;
    height: 100% !important;
    min-height: 500px;
    background: var(--bg-tertiary);
}

/* Edit Controls */
.edit-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-primary);
    margin-top: 16px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

.control-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
}

.control-btn.btn-export {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
}

.control-btn.btn-export:hover {
    background: #00eabc;
}

.control-btn.btn-secondary {
    background: transparent;
}

.tolerance-input {
    width: 110px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.tolerance-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Selection Info */
.selection-info {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 12px;
}

/* Tag Editor */
.tag-editor {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.tag-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-primary);
}

.tag-editor-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.selected-way-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.tag-editor-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tag-field {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tag-field label {
    min-width: 80px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-primary);
}

.tag-field select {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.tag-field select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.control-btn.full-width {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

/* Old class compatibility */
.tag-editor-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.tag-editor-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tag-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tag-label {
    min-width: 80px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-primary);
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    text-align: center;
}

.tag-equals {
    color: var(--text-muted);
    font-weight: 600;
}

.tag-value {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-primary:hover:not(:disabled) {
    background: #00eabc;
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
}

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

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

/* Clear All Button (old class) */
.btn-clear-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--accent-danger);
    border-radius: var(--radius-sm);
    color: var(--accent-danger);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-clear-all:hover {
    background: var(--accent-danger);
    color: white;
}

/* Vertex Markers */
.vertex-marker {
    background: transparent;
    border: none;
}

.vertex-handle {
    width: 14px;
    height: 14px;
    background: var(--accent-danger);
    border: 3px solid white;
    border-radius: 50%;
    cursor: move;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: all var(--transition-fast);
}

.vertex-handle:hover {
    transform: scale(1.3);
    background: #ff6b6b;
}

.vertex-handle.dragging {
    background: var(--accent-secondary);
    transform: scale(1.5);
}

.vertex-handle.split-candidate {
    background: var(--accent-success);
    animation: pulse 2s infinite;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 8px rgba(0, 212, 170, 0); }
}

/* Edit mode indicator */
.edit-mode-active {
    position: relative;
}

.edit-mode-active::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    background: var(--accent-success);
    border: 2px solid var(--bg-secondary);
    border-radius: 50%;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-primary);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .modal-content {
        height: auto;
        max-height: 95vh;
    }
    
    .workflow-steps {
        flex-direction: column;
        align-items: stretch;
    }
    
    .step-connector {
        width: 2px;
        height: 20px;
        margin: 4px auto;
    }
    
    .edit-controls {
        flex-direction: column;
    }
    
    .control-group {
        width: 100%;
        justify-content: center;
    }
}

/* Leaflet Overrides for Dark Theme */
.leaflet-container {
    background: var(--bg-tertiary);
}

.leaflet-control-zoom a {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-elevated) !important;
}

.leaflet-bar {
    border: 1px solid var(--border-primary) !important;
    box-shadow: var(--shadow-sm) !important;
}

.leaflet-control-attribution {
    background: rgba(17, 24, 32, 0.9) !important;
    color: var(--text-muted) !important;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.leaflet-popup-tip {
    background: var(--bg-secondary);
}
