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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f0f0;
}

.container {
    max-width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

h1 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.controls {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.controls label {
    font-weight: bold;
    color: #555;
}

.controls input {
    flex: 1;
    min-width: 250px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.controls button {
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.controls button:hover {
    background-color: #45a049;
}

#refresh-wind {
    background-color: #2196F3;
}

#refresh-wind:hover {
    background-color: #0b7dda;
}

.info-panel {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    min-height: 40px;
}

#wind-info {
    color: #333;
    font-size: 14px;
}

#map {
    flex: 1;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-height: 400px;
}

.wind-marker {
    text-align: center;
    font-weight: bold;
}

.wind-popup {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.wind-popup h3 {
    margin: 0 0 10px 0;
    color: #2196F3;
}

.wind-popup p {
    margin: 5px 0;
    font-size: 13px;
}

.wind-arrow {
    /* Remove positioning that might interfere with Leaflet */
}

.wind-speed-label {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid #333 !important;
    border-radius: 3px !important;
    padding: 2px 5px !important;
    font-size: 11px !important;
    font-weight: bold !important;
    color: #333 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important;
}

.wind-speed-label::before {
    border-right-color: rgba(255, 255, 255, 0.9) !important;
}

.timeline-container {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.timeline-header {
    margin-bottom: 10px;
}

#time-display {
    font-size: 18px;
    font-weight: bold;
    color: #2196F3;
    text-align: center;
}

.timeline-slider {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-slider label {
    font-weight: bold;
    color: #555;
    font-size: 14px;
}

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

#time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    transition: background-color 0.3s;
}

#time-slider::-webkit-slider-thumb:hover {
    background: #0b7dda;
}

#time-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s;
}

#time-slider::-moz-range-thumb:hover {
    background: #0b7dda;
}

#time-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-top: -5px;
}

/* Popup Tabs */
.tabbed-popup {
    min-width: 280px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Make Leaflet popup resizable */
.leaflet-popup-content-wrapper {
    resize: both;
    overflow: auto;
    min-width: 300px;
    min-height: 180px;
}

.leaflet-popup-content {
    margin: 13px 15px !important;
    width: calc(100% - 30px) !important;
    height: calc(100% - 26px) !important;
    display: flex;
    flex-direction: column;
}

/* Resize handle visual indicator */
.leaflet-popup-content-wrapper::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, transparent 50%, #999 50%, #999 60%, transparent 60%, transparent 70%, #999 70%, #999 80%, transparent 80%);
    pointer-events: none;
    border-radius: 0 0 4px 0;
}

.popup-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
}

.popup-tab {
    padding: 6px 12px;
    border: none;
    background: #f0f0f0;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    transition: all 0.2s;
}

.popup-tab:hover {
    background: #e0e0e0;
}

.popup-tab.active {
    background: #2196F3;
    color: white;
}

.popup-tab-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Interval Selector */
.interval-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.interval-selector span {
    font-size: 11px;
    color: #666;
    font-weight: 500;
}

.interval-btn {
    padding: 4px 8px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
}

.interval-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.interval-btn.active {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
}

/* Timeline Forecast */
.timeline-forecast {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.loading-message, .error-message {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.error-message {
    color: #d32f2f;
}

.timeline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 11px;
}

.timeline-row:last-child {
    border-bottom: none;
}

.timeline-time {
    min-width: 70px;
    font-weight: 500;
    color: #555;
}

.timeline-arrow {
    font-size: 22px;
    font-weight: bold;
    width: 28px;
    text-align: center;
    line-height: 1;
}

.timeline-wind-bar {
    flex: 1;
    height: 12px;
    background: #eee;
    border-radius: 6px;
    overflow: hidden;
    min-width: 60px;
}

.wind-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s;
}

.timeline-values {
    display: flex;
    gap: 4px;
    min-width: 90px;
    justify-content: flex-end;
}

.timeline-speed {
    font-weight: bold;
    color: #333;
}

.timeline-gust {
    color: #e65100;
    font-weight: 500;
}

.timeline-dir {
    color: #666;
    min-width: 24px;
}

/* Timeline Legend */
.timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #666;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid #ccc;
}

/* Scrollbar styling for timeline */
.popup-tab-content::-webkit-scrollbar {
    width: 6px;
}

.popup-tab-content::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.popup-tab-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.popup-tab-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Weather Timeline Styles - using table layout for alignment */
.weather-timeline {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

.weather-row,
.weather-header {
    display: table-row;
}

.weather-row > div,
.weather-header > div {
    display: table-cell;
    padding: 4px 4px;
    vertical-align: middle;
    font-size: 11px;
}

.weather-row {
    border-bottom: 1px solid #f0f0f0;
}

.weather-row:last-child {
    border-bottom: none;
}

.weather-time {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.weather-icon {
    width: 32px;
    text-align: center;
}

.weather-icon img {
    width: 28px;
    height: 28px;
    vertical-align: middle;
}

.weather-temp {
    font-weight: bold;
    color: #e65100;
    text-align: center;
    white-space: nowrap;
}

.weather-wind {
    color: #1976D2;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.weather-wind-arrow {
    display: inline-block;
    font-size: 14px;
    margin-right: 2px;
}

.weather-clouds {
    color: #607D8B;
    text-align: center;
    white-space: nowrap;
}

.weather-rain {
    color: #0288D1;
    text-align: center;
    white-space: nowrap;
}

.weather-desc {
    color: #666;
    font-size: 10px;
    text-transform: capitalize;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Weather header row */
.weather-header {
    border-bottom: 2px solid #ddd;
}

.weather-header > div {
    font-size: 10px;
    font-weight: bold;
    color: #888;
    text-transform: uppercase;
    padding: 6px 4px;
}

/* Weather legend */
.weather-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 10px;
    color: #666;
}

.weather-legend-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.weather-legend-icon {
    font-size: 12px;
}

/* Login Overlay Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a237e 0%, #0d47a1 50%, #01579b 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-container {
    background: white;
    padding: 40px 50px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 400px;
}

.login-container h2 {
    color: #1a237e;
    margin-bottom: 15px;
    font-size: 28px;
}

.login-container p {
    color: #666;
    margin-bottom: 30px;
    font-size: 16px;
}

.login-btn {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border: none;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

/* Header with user info */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.header h1 {
    margin-bottom: 0;
    text-align: left;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 8px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-info #user-name {
    color: #555;
    font-size: 14px;
}

.logout-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background: #d32f2f;
}

/* Toggle Controls Button */
.toggle-controls-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #2196F3;
    color: white;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, background-color 0.3s;
}

.toggle-controls-btn:hover {
    background: #1976D2;
}

.toggle-controls-btn .toggle-icon {
    transition: transform 0.3s;
}

.toggle-controls-btn.collapsed .toggle-icon {
    transform: rotate(180deg);
}

/* Top Controls Container */
.top-controls {
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin 0.3s ease-out;
    max-height: 500px;
    opacity: 1;
    overflow: hidden;
}

.top-controls.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0 !important;
}

/* Popup Maximize Button */
.popup-maximize-btn {
    position: absolute;
    top: 8px;
    right: 30px;
    width: 24px;
    height: 24px;
    border: none;
    background: #f0f0f0;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 10;
    transition: background-color 0.2s;
}

.popup-maximize-btn:hover {
    background: #e0e0e0;
}

/* Maximized Popup Overlay */
.popup-maximized-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.popup-maximized-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: calc(100vh - 20px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.popup-maximized-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    background: #f8f8f8;
}

.popup-maximized-header h3 {
    margin: 0;
    color: #2196F3;
    font-size: 18px;
}

.popup-maximized-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f44336;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-maximized-close:hover {
    background: #d32f2f;
}

.popup-maximized-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.popup-maximized-body .popup-tabs {
    position: sticky;
    top: 0;
    background: white;
    padding-bottom: 10px;
    margin-bottom: 10px;
    z-index: 1;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .toggle-controls-btn {
        top: 5px;
        right: 5px;
    }

    .popup-maximized-content {
        max-width: 100%;
        max-height: calc(100vh - 20px);
        border-radius: 8px;
    }

    .popup-maximized-body {
        padding: 10px;
    }
}
