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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Header */
.header {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1800px;
    margin: 0 auto;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Beta Badge */
.beta-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #e67e22, #f39c12);
    color: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(230, 126, 34, 0.3);
    animation: beta-pulse 2s ease-in-out infinite;
}

@keyframes beta-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.subtitle {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* Main Layout */
.main {
    display: flex;
    height: calc(100vh - 80px);
}

/* Map */
.map {
    flex: 1;
    min-height: 400px;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: white;
    padding: 1.5rem;
    overflow-y: auto;
    border-left: 1px solid #ddd;
}

.sidebar h2 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    margin-bottom: 0.75rem;
}

/* Controls */
.controls {
    margin-bottom: 1.5rem;
}

.layer-toggle {
    display: flex;
    gap: 0.5rem;
}

.btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn:hover {
    background: #f0f0f0;
}

.btn.active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

/* Overlays Dropdown */
.nav-dropdown-wrapper {
    position: relative;
}

.nav-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    z-index: 1000;
}

.overlay-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background 0.15s;
}

.overlay-dropdown-item:hover {
    background: #f0f4f8;
}

.overlay-dropdown-item.active {
    background: #2c3e50;
    color: white;
}

.overlay-dropdown-item .overlay-icon {
    font-size: 1.1rem;
}

.overlay-submenu-wrapper {
    position: relative;
}

.overlay-submenu-trigger {
    justify-content: flex-start;
}

.overlay-submenu-arrow {
    margin-left: auto;
    font-size: 1.2rem;
    color: #999;
}

.overlay-submenu {
    display: none;
    position: absolute;
    right: 100%;
    top: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-width: 220px;
}

.overlay-submenu-wrapper:hover > .overlay-submenu {
    display: block;
}

.overlay-submenu-wrapper:hover > .overlay-submenu-trigger {
    background: #f0f4f8;
}

/* Mobile: submenu opens below instead of to the side */
@media (max-width: 600px) {
    .overlay-submenu {
        position: static;
        box-shadow: none;
        border-radius: 0;
        border-top: 1px solid #eee;
        min-width: 0;
    }
    .overlay-submenu .overlay-dropdown-item {
        padding-left: 28px;
    }
}

/* Legend */
.legend {
    margin-bottom: 1.5rem;
}

.legend-gradient {
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(to right,
        #0000aa 0%,
        #0044ff 5%,
        #00aaff 10%,
        #00dddd 15%,
        #00ff99 20%,
        #88ff00 30%,
        #ffff00 50%,
        #ffaa00 70%,
        #ff4400 85%,
        #ff0000 100%
    );
    border: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 0.25rem;
}

/* Tracht-Phase 200-1500+: Rot → Magenta → Lila → Mitternachtsblau */
.legend-gradient-tracht {
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(to right,
        #ff0000 0%,
        #dd0033 4%,
        #bb0066 12%,
        #990099 23%,
        #7700cc 35%,
        #5500dd 54%,
        #3300aa 77%,
        #1a0066 100%
    );
    border: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 0.25rem;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #666;
}

.legend-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #555;
    margin-top: 0.6rem;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Year Selector */
.year-selector {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2c3e50;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2c3e50;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.year-display {
    text-align: center;
}

#year-label {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.year-info {
    font-size: 0.75rem;
    color: #888;
}

/* Forecast Slider */
.forecast-slider-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.forecast-slider-container label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

.forecast-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
}

#forecast-day-label {
    font-size: 1.25rem;
    font-weight: 700;
    color: #e67e22;
}

#forecast-date-label {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    margin-top: 0.25rem;
}

/* Opacity Slider */
.opacity-slider-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.opacity-slider-container label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

.opacity-display {
    text-align: center;
    margin-top: 0.25rem;
}

#opacity-label {
    font-size: 1rem;
    font-weight: 600;
    color: #3498db;
}

/* Info */
.info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
}

.info p {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

#data-status {
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 0.5rem 0.75rem;
    }

    .header-content {
        gap: 0.5rem;
    }

    .header-title h1 {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    .header-nav {
        flex-shrink: 0;
    }

    .nav-icons {
        gap: 0.25rem !important;
    }

    .nav-icon {
        padding: 0.35rem !important;
    }

    .nav-icon svg {
        width: 20px;
        height: 20px;
    }

    .main {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 60px);
    }

    .map {
        height: 55vh;
        min-height: 300px;
    }

    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #ddd;
        padding: 1rem;
    }

    .sidebar h2 {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .controls {
        margin-bottom: 1rem;
    }

    .year-selector {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }

    #year-label {
        font-size: 1.25rem;
    }

    .legend {
        margin-bottom: 1rem;
    }

    .info {
        padding: 0.75rem;
    }

    .info p {
        font-size: 0.8rem;
    }

    .feedback-section {
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .footer {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 400px;
    animation: toast-slide-in 0.3s ease-out;
}

.toast.toast-success {
    border-left: 4px solid #27ae60;
}

.toast.toast-error {
    border-left: 4px solid #e74c3c;
}

.toast.toast-info {
    border-left: 4px solid #3498db;
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-success .toast-icon { color: #27ae60; }
.toast-error .toast-icon { color: #e74c3c; }
.toast-info .toast-icon { color: #3498db; }

.toast-message {
    flex: 1;
    font-size: 0.9rem;
    color: #2c3e50;
}

.toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    line-height: 1;
}

.toast-close:hover {
    color: #666;
}

.toast.toast-hiding {
    animation: toast-slide-out 0.3s ease-in forwards;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Feedback Section */
.feedback-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.feedback-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feedback-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.feedback-intro {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Modal Styles (shared) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

#feedback-form,
#feedback-modal .form-group {
    padding: 0 1.5rem;
}

#feedback-form {
    padding-bottom: 1.5rem;
}

#feedback-modal .form-group:first-of-type {
    margin-top: 1.25rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    padding: 0 1.5rem;
}

/* Debug Assistant */
.assistant-root {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1200;
}

.assistant-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #27ae60, #1f8f4d);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(39, 174, 96, 0.35);
}

.assistant-fab.active {
    transform: scale(0.96);
}

.assistant-panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: min(360px, calc(100vw - 24px));
    max-height: min(560px, calc(100vh - 120px));
    display: none;
    flex-direction: column;
    background: #fff;
    border: 1px solid #dbe3e8;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.2);
}

.assistant-panel.open {
    display: flex;
}

.assistant-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: #1f8f4d;
    color: #fff;
}

.assistant-header h3 {
    margin: 0;
    font-size: 0.95rem;
}

.assistant-header p {
    margin: 2px 0 0;
    font-size: 0.75rem;
    opacity: 0.9;
}

.assistant-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #f8fafb;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.assistant-message {
    max-width: 92%;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.85rem;
    line-height: 1.35;
}

.assistant-message-user {
    align-self: flex-end;
    background: #2c3e50;
    color: #fff;
}

.assistant-message-bot {
    align-self: flex-start;
    background: #fff;
    color: #2c3e50;
    border: 1px solid #e2e8ee;
}

.assistant-message-text {
    white-space: pre-line;
}

.assistant-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.assistant-link {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: #edf4f8;
    color: #1f5f88;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
}

.assistant-link:hover {
    background: #dcecf6;
}

.assistant-quick-actions {
    padding: 8px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #fff;
    border-top: 1px solid #e7edf2;
}

.assistant-quick-btn {
    border: 1px solid #d8e2e9;
    background: #fff;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #38546a;
}

.assistant-quick-btn:hover {
    background: #f1f6f9;
}

.assistant-form {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #e7edf2;
}

.assistant-form input {
    flex: 1;
    border: 1px solid #d4dde5;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.85rem;
}

.assistant-form button {
    border: none;
    border-radius: 8px;
    background: #2c3e50;
    color: #fff;
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
}

@media (max-width: 600px) {
    .assistant-root {
        right: 12px;
        bottom: 12px;
    }

    .assistant-fab {
        width: 48px;
        height: 48px;
        font-size: 0.85rem;
    }

    .assistant-panel {
        position: fixed;
        right: 8px;
        bottom: 68px;
        left: 8px;
        width: auto;
        max-height: calc(100vh - 80px);
    }
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 0 1.5rem;
}

.btn-primary {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.btn-primary:hover {
    background: #34495e;
}

.btn-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Map Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    line-height: 1.5;
    width: auto !important;
}

.leaflet-popup-tip {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.gts-popup {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 0 0 12px 0;
}

.gts-popup hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 8px 0;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: #aaa;
    padding: 0.75rem 2rem;
    font-size: 0.85rem;
}

.footer-content {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer a {
    color: #aaa;
    text-decoration: none;
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

.footer-links {
    display: flex;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Legal Pages (Impressum, Datenschutz) */
.legal-main {
    flex: 1;
    padding: 2rem;
    background: #f5f5f5;
    min-height: calc(100vh - 140px);
}

.legal-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.legal-content h1 {
    color: #2c3e50;
    border-bottom: 3px solid #2c3e50;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.legal-content h2 {
    color: #2c3e50;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.legal-content p {
    line-height: 1.7;
    color: #555;
    margin-bottom: 1rem;
}

.legal-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.legal-content li {
    line-height: 1.7;
    color: #555;
    margin-bottom: 0.3rem;
}

.legal-content a {
    color: #2c3e50;
    font-weight: 500;
}

.legal-content a:hover {
    text-decoration: underline;
}
