@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Sora:wght@300;400;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-dark: #0a0a0f;
    --accent: #00d4aa;
    --accent-dim: rgba(0, 212, 170, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #888899;
}

body {
    font-family: 'Sora', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100dvh;
    width: 100vw;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Map View */
#map-container {
    position: absolute;
    inset: 0;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
}

#map-container.hidden {
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

#draw-canvas {
    position: absolute;
    inset: 0;
    touch-action: none;
    cursor: crosshair;
    z-index: 10;
}

/* Ribbon View */
#ribbon-container {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #0d0d15 0%, #1a1a28 100%);
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
    display: flex;
    flex-direction: column;
}

#ribbon-container.visible {
    transform: translateX(0);
    opacity: 1;
}

/* UI Controls */
.controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 1000;
}

.btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn-primary:hover {
    background: #00ffcc;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 170, 0.4);
}

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

.btn-secondary {
    background: rgba(10, 10, 15, 0.75);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    background: rgba(10, 10, 15, 0.9);
}

/* Header */
.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(180deg, rgba(10, 10, 15, 0.95) 0%, transparent 100%);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 24px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), transparent);
    border-radius: 2px;
}

.status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

/* Instructions */
.instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 500;
}

.instructions.hidden {
    opacity: 0;
}

.instructions h2 {
    font-size: 20px;
    font-weight: 300;
    margin-bottom: 8px;
}

.instructions p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Path Stats */
.path-stats {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 24px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.path-stats.visible {
    opacity: 1;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
}

/* Path Panel */
.path-panel {
    position: absolute;
    top: 80px;
    right: 16px;
    width: 220px;
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    z-index: 1000;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.path-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.path-panel-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.path-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent);
}

.path-list {
    max-height: 240px;
    overflow-y: auto;
}

.path-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.15s ease;
}

.path-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.path-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

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

.path-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.path-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-secondary);
}

.path-delete {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s ease;
}

.path-item:hover .path-delete {
    opacity: 1;
}

.path-delete:hover {
    background: rgba(255, 100, 100, 0.2);
    color: #ff6b6b;
}

.path-panel-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Ribbon View */
.ribbon-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ribbon-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--accent);
}

.ribbon-rows {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ribbon-row {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.ribbon-row-header {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ribbon-row-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.ribbon-row-name {
    font-size: 12px;
}

.ribbon-row-distance {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-secondary);
    margin-left: auto;
}

.ribbon-canvas-wrapper {
    position: relative;
    height: 120px;
}

.ribbon-row-canvas {
    width: 100%;
    height: 120px;
    display: block;
}

.ribbon-overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120px;
    pointer-events: none;
}

.ribbon-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Tile provider selector */
.tile-select {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

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

.tile-select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Draw mode button */
#draw-btn.active {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
}

#locate-btn {
    font-size: 18px;
    padding: 14px 16px;
    line-height: 1;
}

/* Alignment mode toggle */
.align-mode-toggle {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 2px;
}

.align-radio {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.align-radio input {
    display: none;
}

.align-radio span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.align-radio input:checked + span {
    background: var(--accent);
    color: var(--bg-dark);
    font-weight: 600;
}

.align-radio input:disabled + span {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Cursor line and distance label */
.cursor-line {
    position: absolute;
    top: 70px;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    z-index: 10;
    display: none;
}

.cursor-label {
    position: absolute;
    top: 62px;
    transform: translateX(-50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.85);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
    z-index: 11;
    display: none;
    white-space: nowrap;
}
