/**
 * geoloc.css - Geolocation tool styles
 * Uses RPUC design tokens from main.css
 */

/* ===== LAYOUT ===== */

.geoloc-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    font-weight: 400;
}

.geoloc-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    min-height: calc(100vh - 220px);
}

.geoloc-panel-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.geoloc-panel-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* ===== UPLOAD ===== */

.geoloc-upload-section .app-drop-zone {
    padding: 40px 20px;
    margin-bottom: 0;
}

.drop-zone-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.drop-zone-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0 0 4px;
}

.drop-zone-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin: 0;
}

/* ===== IMAGE PREVIEW ===== */

.geoloc-preview-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.geoloc-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface-hover);
}

.geoloc-preview-filename {
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.geoloc-preview-wrapper {
    position: relative;
    background: var(--bg-base);
    overflow: hidden;
}

.geoloc-preview-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
}

.geoloc-region-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.geoloc-region-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
}

.geoloc-region-count {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-left: auto;
}

/* ===== HINTS ===== */

.geoloc-hints-input {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    padding: 10px 14px;
    resize: vertical;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

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

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

/* ===== ANALYZE BUTTON ===== */

.geoloc-analyze-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    font-size: var(--font-size-base);
    font-weight: 700;
    border-radius: var(--radius-md);
}

.analyze-btn-cost {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    opacity: 0.7;
    background: rgba(0,0,0,0.15);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* ===== PROGRESS ===== */

.geoloc-progress {
    padding: 16px 0;
}

.geoloc-progress-bar {
    height: 4px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}

.geoloc-progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    width: 0%;
}

.geoloc-progress-text {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin: 0;
}

/* ===== MAP ===== */

.geoloc-map-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 400px;
    flex: 1;
}

.geoloc-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: var(--bg-base);
}

/* MapLibre GL dark theme overrides */
.maplibregl-map {
    font-family: var(--font-sans) !important;
}

.maplibregl-canvas {
    outline: none;
}

.maplibregl-ctrl-group {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-sm) !important;
}

.maplibregl-ctrl-group button {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.maplibregl-ctrl-group button:hover {
    background: var(--bg-surface-hover) !important;
}

.maplibregl-ctrl-group button .maplibregl-ctrl-icon {
    filter: invert(0.8);
}

.maplibregl-ctrl-attrib {
    background: rgba(13, 26, 38, 0.8) !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
}

.maplibregl-ctrl-attrib a {
    color: var(--text-secondary) !important;
}

/* Tile switcher */
.tile-switcher {
    display: flex;
    gap: 2px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px;
    box-shadow: var(--shadow-sm);
}

.tile-sw-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.15rem;
    transition: all 0.15s ease;
}

.tile-sw-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.tile-sw-btn.active { color: var(--accent); background: var(--accent-bg); }

.maplibregl-popup-content {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 10px 14px !important;
}

.maplibregl-popup-tip {
    border-top-color: var(--bg-surface) !important;
}

.maplibregl-popup-close-button {
    color: var(--text-muted) !important;
    font-size: 18px !important;
    padding: 2px 6px !important;
}

/* EXIF marker */
.geoloc-exif-marker {
    background: none;
    border: none;
}

.exif-marker-dot {
    width: 16px;
    height: 16px;
    background: #3b82f6;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}

/* ===== ACTIONS BAR ===== */

.geoloc-actions-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* ===== CONFIDENCE ===== */

.geoloc-confidence {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.geoloc-confidence-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.geoloc-confidence-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s ease;
}

.geoloc-confidence-fill.high { background: var(--success); }
.geoloc-confidence-fill.medium { background: var(--warning); }
.geoloc-confidence-fill.low { background: var(--error); }

.geoloc-confidence-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ===== RESULTS ===== */

.geoloc-results {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.geoloc-analysis-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

/* Elements */
.geoloc-elements-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.geoloc-element {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-surface-hover);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    flex-wrap: wrap;
}

.geoloc-element-type {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.geoloc-element-desc {
    color: var(--text-secondary);
    flex: 1;
    min-width: 120px;
}

.geoloc-element-value {
    color: var(--text-primary);
    font-weight: 600;
}

.geoloc-element-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.geoloc-element-badge.high { color: var(--success); background: var(--success-bg); }
.geoloc-element-badge.medium { color: var(--warning); background: var(--warning-bg); }
.geoloc-element-badge.low { color: var(--text-muted); background: rgba(255,255,255,0.04); }

/* Locations */
.geoloc-locations-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.geoloc-location {
    padding: 14px;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.geoloc-location:hover {
    border-color: var(--accent-border);
    background: var(--bg-surface-active);
}

.geoloc-location-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.geoloc-location-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.geoloc-location-badge.very_high,
.geoloc-location-badge.high { color: var(--success); background: var(--success-bg); }
.geoloc-location-badge.medium { color: var(--warning); background: var(--warning-bg); }
.geoloc-location-badge.low { color: var(--text-muted); background: rgba(255,255,255,0.04); }

.geoloc-location-detail {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: 6px;
}

.geoloc-location-reasoning {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.5;
}

.geoloc-location-coords-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.geoloc-location-coords {
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    user-select: all;
}

.geoloc-copy-btn {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.geoloc-copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent-border);
}

/* Notes */
.geoloc-note {
    font-size: var(--font-size-xs);
    color: var(--warning);
    padding: 8px 12px;
    background: var(--warning-bg);
    border-radius: var(--radius-sm);
    margin: 4px 0;
}

/* Meta */
.geoloc-meta {
    display: flex;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* EXIF Section */
.geoloc-exif-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
}

.geoloc-exif-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.geoloc-exif-item {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-xs);
}

.geoloc-exif-item .label {
    color: var(--text-muted);
    font-weight: 600;
}

.geoloc-exif-item .value {
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* ===== BUTTONS ===== */

.btn-ghost {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: var(--font-size-xs);
    transition: all 0.15s ease;
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-color-light);
}

.btn-outline {
    background: none;
    border: 1px solid var(--border-color-light);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    transition: all 0.15s ease;
}

.btn-outline:hover, .btn-outline.active {
    color: var(--accent);
    border-color: var(--accent-border);
    background: var(--accent-bg);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 900px) {
    .geoloc-layout {
        grid-template-columns: 1fr;
    }

    .geoloc-map-container {
        min-height: 300px;
    }
}
