/**
 * Umweg App - Styles
 * Version: 2.0 (Modular)
 */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #667eea;
    color: #333;
    overflow: hidden;
}

/* === APP LAYOUT === */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

#map {
    flex: 1;
    width: 100%;
    min-height: 0;
}

/* === HEADER === */
#header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

#header h1 {
    font-size: 14px;
    margin: 0;
}

#header-info {
    font-size: 11px;
    opacity: 0.9;
}

#header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

#api-status {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
}

#api-status.active {
    background: #2ecc71;
}

/* === USER MENU === */
#user-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

#user-btn:hover {
    background: rgba(255,255,255,0.3);
}

#user-menu {
    position: absolute;
    top: 45px;
    right: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    z-index: 2000;
    min-width: 180px;
    overflow: hidden;
}

#user-menu.show {
    display: flex;
}

.menu-item {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-item:hover {
    background: #f8f9fa;
}

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

.menu-item.admin {
    color: #667eea;
    font-weight: 600;
}

.menu-item.logout {
    color: #e74c3c;
}

#user-info {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    color: #666;
}

#user-info strong {
    color: #333;
    display: block;
    font-size: 14px;
}

/* === BOTTOM PANEL === */
#bottom-panel {
    background: white;
    border-top: 2px solid #e0e0e0;
    max-height: 55vh;
    overflow-y: auto;
    display: flex;
}

.section {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
}

/* === CONTROLS === */
#controls {
    display: flex;
    gap: 6px;
    padding: 8px;
    background: white;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
    justify-content: center;
}

.ctrl-btn {
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.ctrl-btn:active {
    transform: scale(0.95);
}

.ctrl-btn.primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.ctrl-btn.success {
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
}

.ctrl-btn.warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.ctrl-btn.danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.ctrl-btn.secondary {
    background: #f8f9fa;
    color: #667eea;
    border: 1px solid #667eea;
}

.ctrl-btn.active {
    box-shadow: 0 0 0 3px rgba(102,126,234,0.4);
}

/* === FORM ELEMENTS === */
input[type="text"],
select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
}

input[type="range"] {
    width: 100%;
    accent-color: #667eea;
    margin: 8px 0;
}

.slider-group {
    margin: 10px 0;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.slider-value {
    background: #667eea;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 6px;
}

.checkbox-item input {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

/* === GPS === */
.gps-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.gps-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.gps-btn.active {
    border-color: #00b894;
    background: #d4edda;
    color: #155724;
}

.search-row {
    display: flex;
    gap: 6px;
}

.search-row input {
    flex: 1;
}

.search-row button {
    padding: 10px 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
}

#gps-status {
    font-size: 11px;
    color: #666;
    margin-top: 6px;
}

/* === STÖRUNGEN === */
.stoerung-list {
    max-height: 120px;
    overflow-y: auto;
}

.stoerung-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 12px;
}

.stoerung-item.passiert {
    opacity: 0.5;
}

.stoerung-delete {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
}

/* === MAP INFO === */
#map-info {
    position: absolute;
    top: 10px;
    left: 50px;
    z-index: 500;
    background: white;
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    font-size: 11px;
    display: flex;
}

#map-info .label {
    color: #888;
    font-size: 9px;
    text-transform: uppercase;
}

#map-info .value {
    font-weight: 700;
    font-size: 14px;
    color: #667eea;
}

/* === STATS === */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-item {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
}

.stat-label {
    font-size: 10px;
    color: #888;
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    color: #667eea;
}

/* === TOAST === */
#toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 10px 18px;
    border-radius: 10px;
    display: flex;
    font-size: 13px;
    max-width: 90%;
    text-align: center;
}

#toast.success { background: #d4edda; color: #155724; }
#toast.error { background: #f8d7da; color: #721c24; }
#toast.warn { background: #fff3cd; color: #856404; }
#toast.info { background: #e8f4f8; color: #667eea; }

/* === STATUS === */
.status {
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    margin-top: 8px;
}

.status-success { background: #d4edda; color: #155724; }
.status-error { background: #f8d7da; color: #721c24; }
.status-info { background: #e8f4f8; color: #667eea; }

/* === POI BAR === */
#poi-bar {
    justify-content: center;
    display: flex;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 6px 8px;
}

.tab-btn {
    padding: 3px 8px;
    border: none;
    border-radius: 4px;
    background: #e0e0e0;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.poi-mini {
    width: 30px;
    height: 30px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poi-mini:hover {
    background: #f0f0f0;
}

.poi-mini.active {
    border-color: #667eea;
    background: #e8f4f8;
}

.poi-mini.osm.active {
    border-color: #27ae60;
    background: #d4edda;
}

/* === POI LIST === */
.poi-list {
    max-height: 150px;
    overflow-y: auto;
}

.poi-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 3px;
    cursor: pointer;
}

.poi-item:hover {
    background: #e8f4f8;
}

.poi-item .icon {
    font-size: 16px;
}

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

.poi-item .name {
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.poi-item .meta {
    font-size: 9px;
    color: #666;
}

.poi-item .distance {
    font-size: 10px;
    color: #667eea;
    font-weight: 600;
}

/* === POI POPUP === */
.poi-popup {
    min-width: 200px;
}

.poi-popup h3 {
    font-size: 14px;
    margin-bottom: 5px;
    color: #333;
}

.poi-popup .meta {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}

.poi-popup .elevation {
    color: #667eea;
    font-weight: 600;
}

.poi-popup .difficulty {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.poi-popup .sg1 { background: #d4edda; color: #155724; }
.poi-popup .sg2 { background: #cce5ff; color: #004085; }
.poi-popup .sg3 { background: #fff3cd; color: #856404; }
.poi-popup .sg4 { background: #f8d7da; color: #721c24; }
.poi-popup .sg5 { background: #343a40; color: white; }

.poi-popup .actions {
    margin-top: 8px;
    display: flex;
    gap: 5px;
}

.poi-popup .actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.poi-popup .btn-nav {
    background: #667eea;
    color: white;
}

/* === MISC === */
#gpx-file {
    display: flex;
}

.warning-text {
    font-size: 10px;
    color: #e67e22;
    margin-top: 4px;
}

.poi-count-badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* === VEHICLE MARKER === */
.vehicle-marker {
    background: transparent;
    border: none;
}

/* === DOWNLOAD MANAGER === */
.dm-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 90%;
    max-width: 400px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.2);
    z-index: 3000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.dm-panel.open {
    right: 0;
}

.dm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.dm-header h3 {
    margin: 0;
    font-size: 16px;
}

.dm-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

#download-manager-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.dm-mode-info {
    text-align: center;
    font-size: 11px;
    color: #888;
    padding: 4px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 8px;
}

.dm-section {
    margin-bottom: 16px;
}

.dm-section h4 {
    font-size: 13px;
    color: #333;
    margin-bottom: 8px;
}

.dm-region-list {
    max-height: 250px;
    overflow-y: auto;
}

.dm-region {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    border: 2px solid transparent;
}

.dm-region:hover {
    background: #e8f4f8;
}

.dm-region.selected {
    border-color: #667eea;
    background: #e8f4f8;
}

.dm-region.downloading {
    background: #fff3cd;
}

.dm-region.downloaded {
    background: #d4edda;
    cursor: default;
}

.dm-region input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.dm-flag {
    font-size: 20px;
}

.dm-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.dm-size {
    font-size: 11px;
    color: #666;
    background: #e0e0e0;
    padding: 2px 8px;
    border-radius: 10px;
}

.dm-progress-container {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.dm-progress {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s;
}

.dm-status {
    font-size: 10px;
    color: #667eea;
    min-width: 60px;
    text-align: right;
}

.dm-delete-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}

.dm-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 16px;
}

.dm-selected-info {
    font-size: 12px;
}

.dm-selected-info strong {
    color: #667eea;
    font-size: 14px;
}

.dm-download-btn,
.dm-cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.dm-download-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.dm-download-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.dm-cancel-btn {
    background: #e74c3c;
    color: white;
}

.dm-downloaded h4 {
    color: #155724;
}

/* Download Button im Header */
.dm-header-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}
.dm-header-btn:hover {
    background: rgba(255,255,255,0.3);
}


/* Download Button im Header */
.dm-header-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}
.dm-header-btn:hover {
    background: rgba(255,255,255,0.3);
}

