:root {
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-2: #334155;
    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Top Warning Bar */
.top-warning-bar {
    background-color: rgba(234, 179, 8, 0.15);
    color: var(--warning);
    text-align: center;
    padding: 6px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-bottom: 1px solid rgba(234, 179, 8, 0.2);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.warning-mobile {
    display: none;
}

@media (max-width: 500px) {
    .warning-desktop {
        display: none;
    }

    .warning-mobile {
        display: grid;
        grid-template-areas: "layer";
        align-items: center;
        justify-content: center;
    }

    .warning-mobile span {
        grid-area: layer;
        opacity: 0;
        animation: cycleText 6s infinite;
    }

    .warning-mobile span:nth-child(1) {
        animation-delay: 0s;
    }

    .warning-mobile span:nth-child(2) {
        animation-delay: 3s;
    }
}

@keyframes cycleText {
    0% {
        opacity: 0;
        transform: translateY(5px);
    }

    10% {
        opacity: 1;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(0);
    }

    50% {
        opacity: 0;
        transform: translateY(-5px);
    }

    100% {
        opacity: 0;
        transform: translateY(-5px);
    }
}

/* Mobile-first Layout */
.app-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    padding: 20px 0;
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Cards & Surfaces */
.card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"] {
    width: 100%;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.input-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
}

.validation-message {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Radio Group */
.radio-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: var(--bg-body);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.radio-option {
    position: relative;
}

.radio-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-option label {
    display: block;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0;
}

.radio-option input:checked+label {
    background-color: var(--bg-surface-2);
    color: var(--primary);
    box-shadow: var(--shadow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #0f172a;
    /* Dark text on bright button */
}

.btn-primary:active {
    transform: scale(0.98);
    background-color: var(--primary-hover);
}

/* Results Area */
.result-box {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-top: 20px;
    animation: slideUp 0.3s ease-out;
}

.result-header {
    padding: 16px;
    background-color: var(--bg-surface-2);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.result-content {
    padding: 16px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-main);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Alerts & Status */
.status-card {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-top: 16px;
    border-left: 4px solid transparent;
}

.status-success {
    background-color: rgba(34, 197, 94, 0.1);
    border-left-color: var(--success);
    color: #86efac;
}

.status-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-left-color: var(--danger);
    color: #fca5a5;
}

.status-warning {
    background-color: rgba(234, 179, 8, 0.1);
    border-left-color: var(--warning);
    color: #fcd34d;
}

/* Flatpickr Dark Theme Overrides */
.flatpickr-calendar {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
}

.flatpickr-day {
    color: var(--text-main) !important;
}

.flatpickr-day.selected {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #0f172a !important;
}

.flatpickr-months .flatpickr-month {
    color: var(--text-main) !important;
    fill: var(--text-main) !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: var(--bg-surface) !important;
}

.flatpickr-time input {
    color: var(--text-main) !important;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utilities */
.d-none {
    display: none !important;
}

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

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mt-3 {
    margin-top: 1rem;
}

.w-100 {
    width: 100%;
}

.row {
    display: flex;
    gap: 16px;
}

.col-6 {
    flex: 1;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-surface-2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Runways & Wind Redesign */
.runways-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.modal-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    animation: scaleIn 0.3s 0.1s forwards;
    opacity: 0;
}

.modal-icon {
    width: 64px;
    height: 64px;
    background-color: rgba(234, 179, 8, 0.1);
    color: var(--warning);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
}

.modal-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
}

.modal-body {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-body p {
    margin-bottom: 12px;
}

.modal-body strong {
    color: var(--text-main);
}

.disclaimer-legal {
    font-size: 0.8rem;
    opacity: 0.8;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.runway-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.runway-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.runway-header {
    background-color: var(--bg-surface-2);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.runway-name {
    font-weight: 700;
    color: var(--text-main);
    font-family: 'Roboto Mono', monospace;
}

.runway-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.runway-ends {
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.runway-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.end-ident {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Roboto Mono', monospace;
    line-height: 1;
}

.wind-data {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.wind-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    width: 100%;
}

.wind-badge span:first-child {
    opacity: 0.8;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.wind-badge.xw {
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.wind-badge.hw {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.wind-badge.tw {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.wind-badge.vrb {
    background-color: rgba(234, 179, 8, 0.1);
    color: var(--warning);
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.section-header i {
    color: var(--primary);
}