/* Charts and Airport Detail Styles */

/* Airport Detail Header */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.controls-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.back-link {
    font-size: 0.9rem;
}

.back-link a {
    display: flex;
    align-items: center;
    color: var(--accent-light);
}

.back-link a:hover {
    color: var(--text-light);
}

.time-controls {
    display: flex;
    gap: 5px;
}

.time-btn {
    padding: 5px 10px;
    background-color: var(--primary-light);
    color: var(--text-light);
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.time-btn:hover {
    background-color: var(--accent);
    color: var(--text-light);
}

.time-btn.active {
    background-color: var(--accent);
    color: var(--text-light);
    font-weight: 600;
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.unit-toggle label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.unit-btn {
    padding: 5px 10px;
    background-color: var(--primary-light);
    color: var(--text-light);
    border-radius: 4px;
    font-size: 0.85rem;
    transition: background-color 0.3s ease;
    cursor: pointer;
    border: none;
}

.unit-btn:hover {
    background-color: var(--accent);
}

.unit-btn.active {
    background-color: var(--accent);
    color: var(--text-light);
    font-weight: 600;
}

/* Error Box */
.error-box {
    background-color: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.error-box h3 {
    color: #ff6666;
    margin-bottom: 10px;
}

/* Current Conditions */
.current-conditions {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 30px;
}

.metar-box {
    background-color: var(--primary);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.metar-box pre {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 10px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

.metar-box p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    text-align: right;
}

.conditions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.condition-card {
    background-color: var(--primary);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.condition-card h4 {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.condition-value {
    font-size: 1.3rem;
    font-weight: 600;
}

.condition-card.flight-category {
    background-color: var(--primary);
}

.condition-card.flight-category.vfr {
    background-color: var(--vfr-color);
}

.condition-card.flight-category.mvfr {
    background-color: var(--mvfr-color);
}

.condition-card.flight-category.ifr {
    background-color: var(--ifr-color);
}

.condition-card.flight-category.lifr {
    background-color: var(--lifr-color);
}

/* Charts */
.charts-container {
    background-color: var(--primary);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
}

.charts-container h3 {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-box {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px;
    height: 300px;
}

.chart-box h4 {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

canvas {
    width: 100% !important;
    height: calc(100% - 30px) !important;
}

.pill {
    display: inline-block;
    padding: 0.35em 0.75em;
    border-radius: 999px;
    font-weight: 600;
    text-align: center;
    min-width: 4em;
    animation: pulse-fade 1.8s ease-in-out;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Animation */
@keyframes pulse-fade {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

/* Flight Category */
.vfr  { background-color: var(--vfr-color);  color: white; }
.mvfr { background-color: var(--mvfr-color); color: white; }
.ifr  { background-color: var(--ifr-color);  color: white; }
.lifr { background-color: var(--lifr-color); color: white; }

/* Winds */
.wind-yellow  { background-color: #ffeb3b; color: black; }
.wind-orange  { background-color: #ff9800; color: white; }
.wind-red     { background-color: #d32f2f; color: white; }

/* Temperature / Dewpoint */
.temp-red       { background-color: #d32f2f; color: white; }
.temp-orange    { background-color: #fb8c00; color: white; }
.temp-green     { background-color: #4caf50; color: white; }
.temp-lightblue { background-color: #81d4fa; color: black; }
.temp-cold      { background-color: white; color: #2196f3; border: 1px solid #2196f3; }

/* Historical Data Table */
.historical-data {
    background-color: var(--primary);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.historical-data h3 {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background-color: var(--primary-light);
    padding: 10px 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.history-table td {
    padding: 8px 15px;
    border-bottom: 1px solid var(--border-color);
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr.vfr {
    background-color: rgba(0, 100, 0, 0.3);
}

.history-table tr.mvfr {
    background-color: rgba(0, 0, 205, 0.3);
}

.history-table tr.ifr {
    background-color: rgba(139, 0, 0, 0.3);
}

.history-table tr.lifr {
    background-color: rgba(148, 0, 211, 0.3);
}

/* Responsive Design */
@media (max-width: 992px) {
    .current-conditions {
        grid-template-columns: 1fr;
    }

    .chart-row {
        grid-template-columns: 1fr;
    }

    .chart-box {
        height: 250px;
    }
}

@media (max-width: 768px) {
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .time-controls {
        width: 100%;
        justify-content: space-between;
    }

    .conditions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .conditions-grid {
        grid-template-columns: 1fr;
    }
}
