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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #1a1a1a;
    color: #ffffff;
}

header {
    background-color: #2c3e50;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 24px;
    margin: 0;
    color: #3498db;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
}

.legal-btn {
    padding: 4px 12px;
    font-size: 12px;
    background-color: #7f8c8d;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.legal-btn:hover {
    background-color: #95a5a6;
}

.legal-btn.active {
    background-color: #e74c3c;
}

.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 14px;
    color: #ecf0f1;
}

.control-group input,
.control-group select {
    padding: 6px 10px;
    border: 1px solid #34495e;
    border-radius: 4px;
    background-color: #34495e;
    color: #ecf0f1;
    font-size: 14px;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #3498db;
}

button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover:not(:disabled) {
    background-color: #2980b9;
}

button:disabled {
    background-color: #7f8c8d;
    cursor: not-allowed;
}

#status-message {
    font-size: 14px;
    color: #e74c3c;
    margin-left: 10px;
}

#status-message.success {
    color: #2ecc71;
}

#status-message.loading {
    color: #f39c12;
}

#main-content {
    display: flex;
    height: 55vh;
    overflow: hidden;
}

#map-container {
    flex: 1;
    position: relative;
    background-color: #34495e;
}

#map {
    width: 100%;
    height: 100%;
}

#control-panel {
    width: 350px;
    background-color: #2c3e50;
    padding: 20px;
    overflow-y: auto;
    border-left: 1px solid #34495e;
}

#control-panel h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #3498db;
}

#control-panel h3 {
    font-size: 16px;
    margin-top: 10px;
    margin-bottom: 10px;
    color: #3498db;
}

#station-info {
    background-color: #34495e;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

#station-info p {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 8px;
}

#station-info .station-name {
    font-size: 16px;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 10px;
}

/* Time Selection Panel */
.time-selection-panel {
    background-color: #34495e;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.time-mode-toggle {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.time-mode-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #3d5a73;
}

.time-mode-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #ecf0f1;
}

.time-mode-option input[type="radio"] {
    accent-color: #3498db;
    cursor: pointer;
}

.time-mode-option span {
    user-select: none;
}

.time-range-section {
    padding-top: 5px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.radio-label input[type="radio"] {
    accent-color: #3498db;
}

.date-range-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.date-range-inputs.hidden {
    display: none;
}

.date-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-input-group label {
    min-width: 45px;
    font-size: 13px;
    color: #bdc3c7;
}

.date-input-group input[type="date"],
.date-input-group select {
    padding: 6px 10px;
    border: 1px solid #2c3e50;
    border-radius: 4px;
    background-color: #2c3e50;
    color: #ecf0f1;
    font-size: 13px;
}

.date-input-group input[type="date"]:focus,
.date-input-group select:focus {
    outline: none;
    border-color: #3498db;
}

/* TAF Section */
#taf-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #34495e;
}

.taf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.taf-header h3 {
    font-size: 16px;
    color: #3498db;
    margin: 0;
}

#taf-raw-section {
    background: #1a252f;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 12px;
}

.taf-raw-label {
    font-size: 11px;
    color: #7f8c8d;
    text-transform: uppercase;
    margin-bottom: 5px;
}

#taf-raw-text {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #ecf0f1;
    word-wrap: break-word;
    line-height: 1.4;
    margin: 0;
}

.data-link {
    color: #3498db;
    text-decoration: none;
    font-size: 11px;
}

.data-link:hover {
    text-decoration: underline;
}

#taf-loading {
    color: #f39c12;
    font-size: 12px;
    padding: 8px;
    text-align: center;
}

.taf-issue-time {
    font-size: 12px;
    color: #ecf0f1;
    margin-bottom: 8px;
}

.taf-decoded {
    font-size: 13px;
}

.decode-item {
    display: flex;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px solid #2c3e50;
}

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

.decode-label {
    min-width: 100px;
    font-weight: bold;
    color: #bdc3c7;
}

.decode-value {
    color: #ecf0f1;
}

.decode-section {
    margin-top: 12px;
    padding: 10px;
    background-color: #2c3e50;
    border-radius: 4px;
}

.decode-section-label {
    display: block;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 8px;
    font-size: 14px;
}

.decode-conditions {
    padding-left: 10px;
}

/* Change group styling */
.change-group {
    margin-top: 10px;
    border-left: 3px solid #888;
    padding-left: 12px;
}

.fm-group {
    border-left-color: #e74c3c;
}

.tempo-group {
    border-left-color: #f39c12;
}

.becmg-group {
    border-left-color: #2ecc71;
}

.prob-group {
    border-left-color: #9b59b6;
}

.decode-note {
    color: #95a5a6;
    font-style: italic;
}

.error {
    color: #e74c3c;
}

.no-data {
    color: #95a5a6;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    background-color: #2c3e50;
    color: #ecf0f1;
}

.leaflet-popup-content {
    font-size: 13px;
    line-height: 1.6;
}

.leaflet-popup-tip {
    background-color: #2c3e50;
}

/* Leaflet tooltip customization */
.leaflet-tooltip {
    background-color: #2c3e50;
    color: #ecf0f1;
    border: 1px solid #3498db;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
}

.leaflet-tooltip-top:before {
    border-top-color: #3498db;
}

/* Dropdown Menu Styles */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    padding: 8px 16px;
    background: #34495e;
    border: 1px solid #3498db;
    color: #3498db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.dropdown-btn:hover {
    background: #3d566e;
}

.dropdown-btn.active {
    background: #3498db;
    color: #1a1a1a;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 140px;
    background: #2c3e50;
    border: 1px solid #3498db;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    margin-top: 4px;
    padding: 6px 0;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #ecf0f1;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: #34495e;
}

.dropdown-item input[type="radio"] {
    width: 14px;
    height: 14px;
    accent-color: #3498db;
    cursor: pointer;
}

/* Overlay Dropdown Styles */
.overlay-dropdown {
    min-width: 220px;
    padding: 0;
}

.overlay-item {
    border-bottom: 1px solid #34495e;
}

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

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
}

.overlay-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ecf0f1;
    font-size: 13px;
    cursor: pointer;
}

.overlay-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #3498db;
    cursor: pointer;
}

.overlay-settings-btn {
    background: transparent;
    border: 1px solid #3498db;
    color: #3498db;
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.overlay-settings-btn:hover {
    background: #3498db;
    color: #1a1a1a;
}

.overlay-settings-btn.active {
    background: #3498db;
    color: #1a1a1a;
}

.overlay-settings {
    background: #34495e;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.overlay-settings.hidden {
    display: none;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #bdc3c7;
}

.setting-row span:first-child {
    min-width: 50px;
}

.setting-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #2c3e50;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
}

.setting-row input[type="color"] {
    width: 28px;
    height: 20px;
    padding: 0;
    border: 1px solid #3498db;
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
}

.setting-value {
    min-width: 35px;
    text-align: right;
    color: #2ecc71;
}

/* Setting checkbox style */
.setting-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 11px;
    color: #bdc3c7;
}

.setting-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #3498db;
}

/* Grid labels on map */
.grid-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Time Range Dropdown Styles */
.time-range-dropdown {
    min-width: 280px;
    padding: 12px;
}

.time-range-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.time-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-input-row label {
    min-width: 40px;
    font-size: 13px;
    color: #bdc3c7;
}

.time-input-row input[type="date"] {
    padding: 6px 8px;
    border: 1px solid #3498db;
    border-radius: 4px;
    background-color: #34495e;
    color: #ecf0f1;
    font-size: 12px;
    width: 130px;
}

.time-input-row select {
    padding: 6px 8px;
    border: 1px solid #3498db;
    border-radius: 4px;
    background-color: #34495e;
    color: #ecf0f1;
    font-size: 12px;
    width: 70px;
}

.time-input-row input[type="date"]:focus,
.time-input-row select:focus {
    outline: none;
    box-shadow: 0 0 6px rgba(52, 152, 219, 0.4);
}

/* Options Dropdown Styles */
.options-dropdown {
    min-width: 180px;
    padding: 8px 12px;
}

.options-item {
    margin-bottom: 8px;
}

.options-item:last-child {
    margin-bottom: 0;
}

.options-item .setting-row span {
    min-width: 80px;
}

.options-item input[type="number"] {
    width: 70px;
    padding: 4px 8px;
    background: #34495e;
    border: 1px solid #3498db;
    border-radius: 4px;
    color: #ecf0f1;
    font-size: 0.85rem;
    text-align: center;
}

.options-item input[type="number"]:focus {
    outline: none;
    box-shadow: 0 0 6px rgba(52, 152, 219, 0.4);
}

/* Legal Modal Styles */
.legal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
}

.legal-modal.hidden {
    display: none !important;
}

.legal-modal-content {
    background-color: #2c3e50;
    border-radius: 8px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.legal-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #34495e;
}

.legal-modal-header h2 {
    color: #3498db;
    font-size: 24px;
    margin: 0;
}

.legal-close-btn {
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.legal-close-btn:hover {
    color: #e74c3c;
}

.legal-modal-body {
    padding: 25px;
    overflow-y: auto;
    color: #ecf0f1;
}

.legal-section {
    margin-bottom: 30px;
}

.legal-section h3 {
    color: #3498db;
    font-size: 18px;
    margin-bottom: 12px;
    border-bottom: 1px solid #34495e;
    padding-bottom: 8px;
}

.legal-section p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.legal-section ul {
    margin-left: 25px;
    margin-bottom: 10px;
}

.legal-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.legal-section a {
    color: #3498db;
    text-decoration: none;
}

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

.warning-box {
    background-color: #e67e22;
    border-left: 4px solid #d35400;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.warning-box p {
    margin: 0;
    color: #ffffff;
}

.warning-box strong {
    font-size: 16px;
}

.legal-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #34495e;
    text-align: center;
    color: #95a5a6;
    font-size: 14px;
}

/* Scrollbar styling */
#control-panel::-webkit-scrollbar,
#taf-section::-webkit-scrollbar {
    width: 8px;
}

#control-panel::-webkit-scrollbar-track,
#taf-section::-webkit-scrollbar-track {
    background: #34495e;
}

#control-panel::-webkit-scrollbar-thumb,
#taf-section::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}

#control-panel::-webkit-scrollbar-thumb:hover,
#taf-section::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* Responsive design */
@media (max-width: 1024px) {
    #control-panel {
        width: 300px;
    }

    header h1 {
        font-size: 20px;
    }

    .controls {
        font-size: 12px;
    }
}

/* TAF Period Display Styles */
.taf-periods {
    margin-top: 10px;
}

.taf-period {
    background: #243342;
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 8px;
    border-left: 3px solid #3498db;
}

.taf-period.period-observation {
    border-left-color: #2ecc71;
    background: #1e3a2f;
}

.taf-period.period-forecast {
    border-left-color: #3498db;
}

.taf-period.period-tempo {
    border-left-color: #f39c12;
    background: #3a3420;
}

.taf-period.period-prob {
    border-left-color: #9b59b6;
    background: #2e2440;
}

.period-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 4px;
}

.period-type {
    font-weight: bold;
    font-size: 11px;
    color: #ecf0f1;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.period-time {
    font-size: 10px;
    color: #95a5a6;
}

.period-conditions {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cond-item {
    font-size: 12px;
    color: #bdc3c7;
}

.cond-item strong {
    color: #ecf0f1;
}

/* Historical Charts Section */
#history-section {
    background-color: #2c3e50;
    padding: 20px;
    border-top: 2px solid #34495e;
}

.history-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.history-header h3 {
    margin: 0;
    font-size: 18px;
    color: #3498db;
}

.history-days-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-days-control label {
    font-size: 14px;
    color: #ecf0f1;
}

.history-days-control input[type="number"] {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #34495e;
    border-radius: 4px;
    background-color: #34495e;
    color: #ecf0f1;
    font-size: 14px;
}

.history-days-control input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
}

#history-loading {
    color: #f39c12;
    font-size: 14px;
    padding: 10px;
    text-align: center;
}

#history-charts {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chart-container {
    background-color: #34495e;
    padding: 15px;
    border-radius: 6px;
}

.chart-title {
    font-size: 14px;
    color: #ecf0f1;
    margin-bottom: 10px;
    font-weight: bold;
}

.chart-canvas {
    width: 100%;
    height: 150px;
    background-color: #ecf0f1;
    border-radius: 4px;
}

@media (max-width: 768px) {
    #main-content {
        flex-direction: column;
        height: auto;
    }

    #map-container {
        height: 50vh;
    }

    #control-panel {
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid #34495e;
    }

    #taf-section {
        max-height: none;
    }
}
