/* 
   TravelRoute Studio - Modern Dark Studio Styles
   Designed for creators, travel vloggers, and modern web UX
*/

:root {
    --bg-base: #090d16;
    --bg-surface: #111827;
    --bg-surface-elevated: #1a2234;
    --bg-input: #0d131f;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #3b82f6;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-orange: #ff6b35;
    --accent-emerald: #10b981;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.35);
}

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

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    height: 100dvh;
    width: 100%;
    -webkit-font-smoothing: antialiased;
}

/* Układ główny */
.app-layout {
    display: flex;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
}

/* Panel boczny */
.sidebar {
    width: 440px;
    min-width: 400px;
    height: 100%;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 20;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
}

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

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

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}

.logo h1 {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 30%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo .tagline {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Szybki wybór presetu */
.preset-box {
    padding: 12px 24px;
    background: rgba(59, 130, 246, 0.08);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preset-box label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #93c5fd;
}

.preset-box select {
    background-color: var(--bg-surface-elevated);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

/* Zakładki */
.tabs-nav {
    display: flex;
    padding: 8px 16px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    gap: 6px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 4px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    color: #ffffff;
    background-color: var(--bg-surface-elevated);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tab-icon {
    font-size: 14px;
}

/* Kontener zawartości zakładek */
.tab-content-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.tab-content-container::-webkit-scrollbar {
    width: 6px;
}

.tab-content-container::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.tab-panel {
    display: none;
    flex-direction: column;
    gap: 18px;
}

.tab-panel.active {
    display: flex;
}

/* Formularze i elementy interfejsu */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.label-with-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.val-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: #38bdf8;
}

.input-with-button {
    display: flex;
    gap: 8px;
}

input[type="text"], select {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

input[type="text"]:focus, select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-pick {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: #ffffff;
    font-size: 16px;
    width: 44px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-pick:hover {
    background-color: #2a364f;
    border-color: #3b82f6;
}

.btn-pick.active {
    background-color: var(--accent-primary);
    border-color: #60a5fa;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}

/* Wiersz akcji domyślnej lokalizacji */
.start-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.btn-action-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-action-small:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #ffffff;
}

.btn-action-small.active {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.45);
    color: #34d399;
}

/* Wyniki autouzupełniania miast */
.autocomplete-results {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: var(--bg-surface-elevated);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    max-height: 220px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.15s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: rgba(59, 130, 246, 0.2);
}

.autocomplete-item strong {
    font-size: 13px;
    color: #ffffff;
}

.autocomplete-item small {
    font-size: 11px;
    color: var(--text-muted);
}

/* Czytelne karty START i STOP */
.route-card {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.start-card {
    border-left: 4px solid #22c55e;
}

.start-card:focus-within {
    border-color: rgba(34, 197, 94, 0.4);
    border-left-color: #4ade80;
}

.stop-card {
    border-left: 4px solid #ef4444;
}

.stop-card:focus-within {
    border-color: rgba(239, 68, 68, 0.4);
    border-left-color: #f87171;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-badge {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 6px;
}

.start-badge {
    background-color: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.stop-badge {
    background-color: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.card-tip {
    font-size: 11px;
    color: var(--text-muted);
}

.point-input {
    font-size: 15px !important;
    font-weight: 600 !important;
    padding: 12px 14px !important;
    background-color: var(--bg-input) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
}

.point-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Przycisk zamiany miejsc */
.swap-row {
    display: flex;
    justify-content: center;
    margin: 2px 0;
}

.btn-swap-prominent {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn-swap-prominent span {
    font-size: 15px;
    color: #38bdf8;
}

.btn-swap-prominent:hover {
    background-color: #243248;
    color: #ffffff;
    border-color: #38bdf8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

/* Grupa radio boxów */
.radio-group-boxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.radio-box {
    cursor: pointer;
}

.radio-box input {
    display: none;
}

.radio-box .box-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    text-align: center;
}

.radio-box .box-content .icon {
    font-size: 18px;
}

.radio-box .box-content .title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.radio-box input:checked + .box-content {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.radio-box input:checked + .box-content .title {
    color: #ffffff;
}

/* Karta informacyjna */
.info-card {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    align-items: flex-start;
}

.info-icon {
    font-size: 18px;
}

.info-text strong {
    font-size: 12px;
    color: var(--text-primary);
}

.info-text span {
    font-weight: 700;
    color: #38bdf8;
}

.info-text .hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Siatka wyboru pojazdów */
.vehicle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.vehicle-card {
    padding: 10px 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.vehicle-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: var(--bg-surface-elevated);
}

.vehicle-card.active {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Suwaki Range */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #38bdf8;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.color-picker-wrapper {
    height: 38px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px;
    display: flex;
    align-items: center;
}

input[type="color"] {
    border: none;
    background: transparent;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border-radius: 4px;
}

.color-pills-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-pill {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.color-pill:hover {
    transform: scale(1.15);
    border-color: #ffffff;
}

.separator {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 4px 0;
}

/* Lista kafelków mapy */
.radio-tiles-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.radio-tile-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.radio-tile-item:hover {
    background-color: var(--bg-surface-elevated);
}

.radio-tile-item input:checked + span {
    color: #38bdf8;
    font-weight: 700;
}

/* Przyciski proporcji kadru */
.ratio-buttons-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.ratio-btn {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.ratio-btn .ratio-tag {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
}

.ratio-btn .ratio-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.ratio-btn.active {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.ratio-btn.active .ratio-tag {
    color: #38bdf8;
}

/* Przyciski presetów tempa */
.speed-presets-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.speed-btn {
    padding: 9px 4px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

.speed-btn:hover {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.speed-btn.active {
    background-color: rgba(59, 130, 246, 0.25);
    border-color: var(--accent-primary);
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
}

/* Sekcja Eksportu */
.export-promo-card {
    padding: 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(16, 185, 129, 0.1) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-lg);
}

.export-promo-card h3 {
    font-size: 15px;
    margin-bottom: 6px;
    color: #ffffff;
}

.export-promo-card p {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.export-buttons-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-primary, .btn-secondary, .btn-tertiary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background-color: #243048;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-tertiary {
    padding: 10px 14px;
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
}

.btn-tertiary:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-large {
    padding: 14px 20px;
    text-align: left;
}

.btn-large .btn-icon {
    font-size: 24px;
}

.btn-large strong {
    font-size: 14px;
    display: block;
}

.btn-large small {
    font-size: 11px;
    opacity: 0.8;
    display: block;
}

.compatibility-notice {
    padding: 12px 14px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 11px;
    color: var(--text-muted);
}

.compatibility-notice strong {
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

/* ================== OBSZAR PODGLĄDU GŁÓWNEGO ================== */
.preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-base);
    position: relative;
    overflow: hidden;
}

.preview-header {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(8px);
}

.preview-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

.resolution-badge {
    font-size: 11px;
    font-weight: 700;
    color: #a855f7;
    background-color: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 3px 10px;
    border-radius: 12px;
}

.preview-controls-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.btn-reset-view {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.btn-reset-view:hover {
    color: #ffffff;
    background-color: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.btn-reset-view.active {
    background: rgba(14, 165, 233, 0.22);
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.btn-reset-view.active:hover {
    background: rgba(14, 165, 233, 0.35);
    color: #ffffff;
    border-color: #7dd3fc;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
}

/* Strefa viewportu z kadrówką */
.viewport-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at center, rgba(30, 41, 59, 0.4) 0%, rgba(9, 13, 22, 0.9) 100%);
}

.canvas-frame {
    position: relative;
    max-height: calc(100vh - 170px);
    max-width: calc(100vw - 500px);
    aspect-ratio: 9 / 16;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
    background-color: #0f172a;
    transition: aspect-ratio 0.3s ease;
}

#mapCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

#mapCanvas:active {
    cursor: grabbing;
}

/* Pasek odtwarzacza na dole */
.playback-bar {
    height: 64px;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 18px;
    z-index: 10;
}

.player-controls {
    display: flex;
    gap: 8px;
}

.player-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: #ffffff;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.player-btn:hover {
    background-color: #2c3a54;
    border-color: #3b82f6;
    transform: scale(1.05);
}

.player-btn.active {
    color: #38bdf8;
    border-color: #38bdf8;
}

.scrubber-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
}

#timelineScrubber {
    height: 8px;
}

.player-info {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 90px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Modal postępu eksportu */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background-color: var(--bg-surface-elevated);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-xl);
    padding: 36px 40px;
    width: 440px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.modal-spinner {
    font-size: 42px;
    animation: bounce 1.5s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.modal-box h3 {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
}

.modal-box p {
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background-color: var(--bg-input);
    border-radius: 5px;
    overflow: hidden;
    margin: 8px 0;
    border: 1px solid var(--border-color);
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    transition: width 0.1s ease;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.8);
}

.modal-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ================== PRZEŁĄCZNIK PROJEKCJI I PRESETY ================== */
.projection-toggle-group {
    display: inline-flex;
    background-color: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 4px;
}

.view-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.view-toggle-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
}

.view-toggle-btn.active {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.45);
}

.preset-selector-group {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
    border: 1px solid rgba(14, 165, 233, 0.35);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
}

.preset-dropdown {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--bg-input);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.preset-dropdown:hover, .preset-dropdown:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

/* =========================================================================
   PLAKIETKA TESTERA W PANELU BOCZNYM
   ========================================================================= */

.beta-user-badge {
    margin-top: 10px;
    padding: 6px 10px;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.3);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
}

.beta-user-badge .tester-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #93c5fd;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.beta-user-badge .tester-avatar {
    font-size: 13px;
}

.btn-logout-small {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout-small:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ffffff;
    border-color: #ef4444;
}

/* =========================================================================
   BRAMA LOGOWANIA DLA BETA TESTERÓW (BETA ACCESS GATE)
   ========================================================================= */

.beta-gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #030712;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.beta-gate-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Tło z poświatami */
.beta-gate-backdrop {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.35;
    pointer-events: none;
}

.orb-top {
    width: 500px;
    height: 500px;
    top: -150px;
    left: 20%;
    background: radial-gradient(circle, #3b82f6 0%, rgba(59, 130, 246, 0) 70%);
}

.orb-bottom {
    width: 600px;
    height: 600px;
    bottom: -200px;
    right: 15%;
    background: radial-gradient(circle, #0284c7 0%, rgba(14, 165, 233, 0) 70%);
}

/* Karta formularza */
.beta-gate-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    background: rgba(17, 24, 39, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 35px rgba(59, 130, 246, 0.15);
    border-radius: 20px;
    padding: 32px 28px;
    animation: cardAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardAppear {
    0% { opacity: 0; transform: translateY(18px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.beta-gate-header {
    text-align: center;
    margin-bottom: 24px;
}

.beta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.35);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #38bdf8;
    margin-bottom: 14px;
}

.beta-dot {
    width: 7px;
    height: 7px;
    background-color: #38bdf8;
    border-radius: 50%;
    box-shadow: 0 0 8px #38bdf8;
}

.beta-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.beta-logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.5));
}

.beta-logo h2 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 40%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.beta-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 4px;
}

/* Pola wejściowe formularza */
.beta-form .form-group {
    margin-bottom: 18px;
}

.beta-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 6px;
}

.optional-label {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
}

.required-mark {
    color: #f43f5e;
}

.beta-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(13, 19, 31, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}

.beta-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
    background: rgba(15, 23, 42, 0.95);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .beta-input {
    padding-right: 44px;
    letter-spacing: 0.05em;
}

.btn-toggle-pwd {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.btn-toggle-pwd:hover {
    color: #ffffff;
}

/* Komunikat o błędzie */
.beta-error-msg {
    display: none;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-md);
    color: #fca5a5;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 16px;
    text-align: left;
}

.beta-error-msg.visible {
    display: block;
    animation: shakeError 0.4s ease;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Przycisk Wejdź */
.btn-beta-submit {
    width: 100%;
    padding: 13px 20px;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.4);
    transition: all 0.2s ease;
}

.btn-beta-submit:hover {
    background: linear-gradient(135deg, #0284c7 0%, #1d4ed8 100%);
    box-shadow: 0 6px 22px rgba(14, 165, 233, 0.55);
    transform: translateY(-1px);
}

.btn-beta-submit:active {
    transform: translateY(1px);
}

/* Stopka karty */
.beta-gate-footer {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    text-align: center;
}

.beta-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.beta-hint-highlight {
    color: #93c5fd;
    font-weight: 600;
}

.beta-status-info {
    font-size: 11px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.secure-icon {
    font-size: 12px;
}

/* =========================================================================
   RESPONSYWNOŚĆ DLA SMARTFONÓW I TABLETÓW (MOBILE & TABLET RESPONSIVE)
   ========================================================================= */

.btn-mobile-expand {
    display: none;
}

@media (max-width: 900px) {
    /* Główny kontener - podział pionowy (Split View) */
    .app-layout {
        flex-direction: column;
        height: 100dvh;
        width: 100%;
        overflow: hidden;
    }

    /* 1. GÓRA: Strefa podglądu na żywo */
    .preview-area {
        order: 1;
        width: 100%;
        height: 44dvh;
        min-height: 220px;
        flex: none;
        border-bottom: 2px solid rgba(56, 189, 248, 0.35);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.65);
        z-index: 15;
        transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        flex-direction: column;
    }

    /* Tryb powiększonego podglądu na telefonie */
    .app-layout.preview-expanded .preview-area {
        height: 75dvh;
    }

    .preview-header {
        height: 42px;
        min-height: 42px;
        padding: 4px 10px;
        gap: 6px;
    }

    .preview-status {
        display: none; /* Ukryj na telefonach, aby nie ściskać przycisków */
    }

    .resolution-badge {
        display: none; /* Ukryj zbędny tekst na telefonach */
    }

    .preview-controls-top {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
    }

    .projection-toggle-group {
        padding: 2px;
        gap: 2px;
    }

    .view-toggle-btn {
        padding: 4px 8px;
        font-size: 11px;
        gap: 4px;
    }

    .btn-reset-view {
        padding: 4px 8px;
        font-size: 11px;
    }

    .btn-mobile-expand {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 4px 8px;
        font-size: 11px;
        font-weight: 700;
        color: #38bdf8;
        background: rgba(14, 165, 233, 0.15);
        border: 1px solid rgba(14, 165, 233, 0.4);
        border-radius: var(--radius-sm);
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .btn-mobile-expand:hover, .btn-mobile-expand:active {
        background: rgba(14, 165, 233, 0.3);
        color: #ffffff;
    }

    /* Viewport i Canvas dopasowane do górnego kadru */
    .viewport-stage {
        flex: 1;
        padding: 6px 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        background: radial-gradient(circle at center, rgba(30, 41, 59, 0.3) 0%, rgba(3, 7, 18, 0.95) 100%);
    }

    .canvas-frame {
        max-height: 100%;
        max-width: 100%;
        width: auto;
        height: auto;
        border-radius: var(--radius-md);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.75);
    }

    /* Pasek odtwarzacza */
    .playback-bar {
        height: 48px;
        min-height: 48px;
        padding: 0 12px;
        gap: 10px;
    }

    .player-btn {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .player-info {
        font-size: 11px;
        min-width: 60px;
        text-align: right;
    }

    /* 2. DÓŁ: Panel sterowania i konfiguracji trasy */
    .sidebar {
        order: 2;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        flex: 1;
        height: auto;
        border-right: none;
        border-top: 1px solid var(--border-color);
        box-shadow: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .sidebar-header {
        padding: 8px 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .logo {
        gap: 8px;
    }

    .logo-icon {
        font-size: 20px;
    }

    .logo h1 {
        font-size: 14px;
    }

    .logo .tagline {
        display: none;
    }

    .beta-user-badge {
        margin-top: 0;
        padding: 3px 8px;
        font-size: 11px;
        gap: 6px;
    }

    /* Poziome, dotykowe zakładki nawigacji */
    .tabs-nav {
        padding: 4px 8px;
        gap: 4px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        background-color: var(--bg-surface-elevated);
        border-bottom: 1px solid var(--border-color);
        display: flex;
    }

    .tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex: 1;
        min-width: 68px;
        padding: 8px 4px;
        font-size: 11px;
        flex-direction: column;
        gap: 3px;
        text-align: center;
        border-radius: var(--radius-sm);
        white-space: nowrap;
    }

    .tab-icon {
        font-size: 15px;
        margin: 0;
    }

    /* Zawartość zakładek */
    .tab-content-container {
        flex: 1;
        overflow-y: auto;
        padding: 12px 14px 30px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .route-card {
        padding: 12px;
        margin-bottom: 10px;
    }

    .input-with-button {
        gap: 6px;
    }

    .point-input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .btn-pick {
        min-width: 40px;
        min-height: 40px;
        font-size: 16px;
    }

    .vehicle-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .vehicle-card {
        padding: 8px 4px;
    }

    .vehicle-icon {
        font-size: 22px;
    }

    .vehicle-name {
        font-size: 10px;
    }

    .format-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .fps-selector, .quality-selector {
        gap: 6px;
    }

    .btn-large {
        padding: 12px 16px;
    }

    /* Brama na telefonach */
    .beta-gate-card {
        padding: 24px 20px;
        border-radius: 16px;
    }
}




