/* ============================================================
   ARG Offline Map Server - Design System
   Matches ArgDeviceCatalog design language
   ============================================================ */

/* ==================== CSS Variables ==================== */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-card-hover: #263347;
    --bg-input: #0f172a;
    --bg-modal: rgba(0, 0, 0, 0.7);

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-heading: #f1f5f9;

    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-blue-light: rgba(59, 130, 246, 0.15);
    --accent-green: #10b981;
    --accent-green-light: rgba(16, 185, 129, 0.15);
    --accent-orange: #f59e0b;
    --accent-orange-light: rgba(245, 158, 11, 0.15);
    --accent-red: #ef4444;
    --accent-red-light: rgba(239, 68, 68, 0.15);
    --accent-purple: #8b5cf6;
    --accent-purple-light: rgba(139, 92, 246, 0.15);
    --accent-cyan: #06b6d4;
    --accent-cyan-light: rgba(6, 182, 212, 0.15);

    --border-color: #334155;
    --border-light: #475569;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    --transition: all 0.2s ease;

    --header-height: 56px;
    --stats-height: 72px;
    --tabs-height: 48px;
}

/* ==================== Reset ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Vazirmatn', 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-blue-hover); }

/* ==================== Header ==================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-heading);
}

.header-logo i {
    color: var(--accent-blue);
    font-size: 22px;
}

.header-logo small {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 8px;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.header-search {
    position: relative;
    width: 280px;
}

.header-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.header-search input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-light);
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 5px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== Stats Bar ==================== */
.stats-bar {
    display: flex;
    gap: 16px;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 160px;
    flex: 1;
}

.stat-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 16px;
}

.stat-icon.blue { background: var(--accent-blue-light); color: var(--accent-blue); }
.stat-icon.green { background: var(--accent-green-light); color: var(--accent-green); }
.stat-icon.orange { background: var(--accent-orange-light); color: var(--accent-orange); }
.stat-icon.purple { background: var(--accent-purple-light); color: var(--accent-purple); }
.stat-icon.cyan { background: var(--accent-cyan-light); color: var(--accent-cyan); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================== Tab Navigation ==================== */
.tab-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 24px;
    height: var(--tabs-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tab-btn i {
    font-size: 14px;
}

.tab-badge {
    font-size: 10px;
    padding: 1px 6px;
    background: var(--accent-blue-light);
    color: var(--accent-blue);
    border-radius: 10px;
    font-weight: 600;
}

/* ==================== Content Area ==================== */
.content {
    padding: 24px;
    min-height: calc(100vh - var(--header-height) - var(--stats-height) - var(--tabs-height));
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== Section Headers ==================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--accent-blue);
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
    text-decoration: none;
    color: white;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--accent-blue); border-color: var(--accent-blue); }
.btn-primary:hover { background: var(--accent-blue-hover); }

.btn-success { background: var(--accent-green); }
.btn-success:hover { opacity: 0.9; }

.btn-danger { background: var(--accent-red); }
.btn-danger:hover { opacity: 0.9; }

.btn-warning { background: var(--accent-orange); color: #0f172a; }
.btn-warning:hover { opacity: 0.9; }

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

.btn-group {
    display: flex;
    gap: 4px;
}

/* ==================== Cards ==================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--accent-blue);
    font-size: 14px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* ==================== Tables ==================== */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

tbody td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

.table-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.table-empty i {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
    opacity: 0.3;
}

/* ==================== Badges ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-blue { background: var(--accent-blue-light); color: var(--accent-blue); }
.badge-green { background: var(--accent-green-light); color: var(--accent-green); }
.badge-orange { background: var(--accent-orange-light); color: var(--accent-orange); }
.badge-red { background: var(--accent-red-light); color: var(--accent-red); }
.badge-purple { background: var(--accent-purple-light); color: var(--accent-purple); }
.badge-cyan { background: var(--accent-cyan-light); color: var(--accent-cyan); }

/* ==================== Form Controls ==================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==================== Grid Layouts ==================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ==================== Modal ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.modal-close:hover {
    background: var(--accent-red-light);
    color: var(--accent-red);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.modal-wide {
    max-width: 900px;
}

/* ==================== Toast Notifications ==================== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 320px;
    max-width: 450px;
    font-size: 13px;
    animation: toastSlideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--accent-green); }
.toast.success i { color: var(--accent-green); }
.toast.error { border-left: 4px solid var(--accent-red); }
.toast.error i { color: var(--accent-red); }
.toast.info { border-left: 4px solid var(--accent-blue); }
.toast.info i { color: var(--accent-blue); }
.toast.warning { border-left: 4px solid var(--accent-orange); }
.toast.warning i { color: var(--accent-orange); }

.toast i { font-size: 16px; flex-shrink: 0; }

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    font-size: 14px;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==================== Progress Bar ==================== */
.progress {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ==================== Upload Area ==================== */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent-blue);
    background: var(--accent-blue-light);
}

.upload-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-text {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================== Map Containers ==================== */
.map-container {
    height: 420px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.map-preview {
    height: 350px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Leaflet Dark Theme Adjustments */
.leaflet-container { background: var(--bg-primary) !important; }
.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}
.leaflet-control-zoom a:hover {
    background: var(--bg-tertiary) !important;
}

/* ==================== Preset Chips ==================== */
.preset-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preset-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.preset-chip:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
    background: var(--accent-blue-light);
}

.preset-chip.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.preset-chip small {
    color: var(--text-muted);
    font-size: 10px;
}

.preset-chip.active small {
    color: rgba(255,255,255,0.7);
}

/* ==================== API Docs ==================== */
.api-section {
    margin-bottom: 24px;
}

.api-endpoint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.api-endpoint:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
}

.api-endpoint .desc {
    margin-left: auto;
    font-family: inherit;
    font-size: 11px;
    color: var(--text-muted);
}

.method {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    min-width: 48px;
    text-align: center;
    letter-spacing: 0.3px;
}

.method-get { background: var(--accent-green-light); color: var(--accent-green); }
.method-post { background: var(--accent-blue-light); color: var(--accent-blue); }
.method-put { background: var(--accent-orange-light); color: var(--accent-orange); }
.method-delete { background: var(--accent-red-light); color: var(--accent-red); }

.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    color: var(--accent-green);
    margin-bottom: 16px;
    overflow-x: auto;
    line-height: 1.8;
}

/* ==================== Info Grid ==================== */
.info-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0;
}

.info-label {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.info-value {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

/* ==================== Job Status ==================== */
.job-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.job-card:hover {
    border-color: var(--border-light);
}

.job-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.job-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-heading);
}

.job-meta {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 12px;
}

.job-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ==================== Settings ==================== */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.setting-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Consolas', monospace;
}

/* ==================== Loading ==================== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    padding: 48px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ==================== Responsive ==================== */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .stats-bar { flex-wrap: wrap; }
    .header-search { display: none; }
    .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .content { padding: 16px; }
    .stats-bar { padding: 12px 16px; }
    .tab-nav { padding: 0 16px; }
}

/* ==================== Download Map ==================== */
.download-map-container {
    height: 500px;
    cursor: crosshair !important;
}

.download-coords-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    flex-wrap: wrap;
}

.coord-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.coord-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-blue);
    background: var(--accent-blue-light);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    min-width: 24px;
    text-align: center;
}

.coord-input {
    width: 110px;
    padding: 5px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    outline: none;
    transition: var(--transition);
}

.coord-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-blue-light);
}

.coord-hint {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.coord-hint.has-selection {
    color: var(--accent-green);
}

.estimate-bar {
    display: flex;
    justify-content: space-around;
    padding: 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    text-align: center;
}

.estimate-item {
    flex: 1;
}

.estimate-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-blue);
    line-height: 1.2;
}

.estimate-value.orange { color: var(--accent-orange); }
.estimate-value.purple { color: var(--accent-purple); }

.estimate-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

/* Leaflet draw toolbar dark theme */
.leaflet-draw-toolbar a {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.leaflet-draw-toolbar a:hover {
    background-color: var(--bg-tertiary) !important;
}

.leaflet-draw-actions a {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.leaflet-draw-tooltip {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* ==================== Regions Map Viewer ==================== */
.regions-map-card {
    position: relative;
}

.regions-map-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-control-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.regions-map-container {
    height: 450px;
    transition: height 0.3s ease;
}

.regions-map-container.fullscreen {
    height: calc(100vh - 120px);
}

.regions-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-secondary);
    min-height: 36px;
    align-items: center;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.legend-item:hover {
    border-color: var(--accent-blue);
    background: var(--accent-blue-light);
}

.legend-item.active {
    border-color: var(--accent-blue);
    background: var(--accent-blue-light);
    color: var(--accent-blue);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.2);
}

.region-color-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 2px solid;
    vertical-align: middle;
}

/* ==================== 3D Globe ==================== */
.grid-globe {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    height: calc(100vh - var(--header-height) - var(--stats-height) - var(--tabs-height) - 120px);
    min-height: 500px;
}

.globe-card {
    position: relative;
    overflow: hidden;
}

.globe-container {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border-radius: var(--radius-lg);
}

.globe-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    max-height: calc(100vh - var(--header-height) - var(--stats-height) - var(--tabs-height) - 120px);
}

.globe-style-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.globe-style-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.globe-style-chip:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
    background: var(--accent-blue-light);
}

.globe-style-chip.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.globe-style-chip i {
    font-size: 13px;
}

.form-range {
    width: 100%;
    height: 6px;
    appearance: none;
    background: var(--bg-primary);
    border-radius: 3px;
    outline: none;
    margin: 8px 0;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-blue);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.form-range::-webkit-slider-thumb:hover {
    background: var(--accent-blue-hover);
    transform: scale(1.2);
}

.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent-blue);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.globe-region-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.globe-region-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.globe-region-item:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
    background: var(--accent-blue-light);
}

.globe-region-item i {
    color: var(--accent-blue);
}

/* ==================== Mini Globe Widget ==================== */
.mini-globe-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent-blue);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3), 0 8px 32px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    z-index: 500;
    transition: all 0.3s ease;
}

.mini-globe-widget:hover {
    transform: scale(1.1);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.4), 0 8px 32px rgba(0, 0, 0, 0.5);
}

.mini-globe-map {
    width: 100%;
    height: 100%;
}

.mini-globe-label {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-blue);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

/* MapLibre overrides for dark theme */
.maplibregl-ctrl-attrib { display: none !important; }
.maplibregl-ctrl-group button {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}
.maplibregl-ctrl-group button:hover {
    background: var(--bg-tertiary) !important;
}
.maplibregl-popup-content {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    padding: 12px !important;
    box-shadow: var(--shadow-lg) !important;
}
.maplibregl-popup-tip {
    border-top-color: var(--bg-card) !important;
}
.maplibregl-popup-close-button {
    color: var(--text-secondary) !important;
    font-size: 18px !important;
}

@media (max-width: 900px) {
    .grid-globe { grid-template-columns: 1fr; }
    .globe-sidebar { max-height: none; }
    .mini-globe-widget { width: 100px; height: 100px; bottom: 16px; right: 16px; }
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }
