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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #059669;
    --error-color: #dc2626;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/hero-bg.jpg');
    background-size: cover;
    background-position: center 40%;
    background-repeat: no-repeat;
    filter: blur(4px) brightness(0.65) saturate(1.2);
    z-index: -2;
    transform: scale(1.05);
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        160deg,
        rgba(15, 23, 42, 0.45) 0%,
        rgba(30, 64, 175, 0.3) 40%,
        rgba(56, 189, 248, 0.15) 100%
    );
    z-index: -1;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 40px rgba(56, 189, 248, 0.15);
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

main {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.search-section h2 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.help-text {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.search-box {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.datetime-box {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.datetime-box label {
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.95rem;
}

.day-selector {
    flex: 1;
    min-width: 150px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    color: var(--text-dark);
    cursor: pointer;
    transition: border-color 0.2s;
}

.day-selector:focus {
    outline: none;
    border-color: var(--primary-color);
}

.day-selector:hover {
    border-color: var(--primary-color);
}

#datetime-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

#datetime-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

#location-input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

#location-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

button {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background: var(--primary-hover);
}

#location-btn {
    background: var(--success-color);
}

#location-btn:hover {
    background: #047857;
}

.loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.error {
    background: #fee2e2;
    color: var(--error-color);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--error-color);
}

.hidden {
    display: none;
}

.results {
    margin-top: 2rem;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.results-header h2 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.location-info {
    color: var(--text-light);
    font-size: 0.95rem;
}

.sort-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.sort-label {
    color: var(--text-light);
    font-size: 0.875rem;
    font-weight: 500;
}

.sort-select {
    padding: 0.4rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-dark);
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.sort-select:hover {
    border-color: var(--primary-color);
}

.count {
    color: var(--text-light);
    margin-top: 0.5rem;
}

.sites-list {
    display: grid;
    gap: 1rem;
}

.site-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.site-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.site-header > div {
    flex: 1;
}

.site-header h3 {
    color: var(--text-dark);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.distance {
    background: var(--primary-color);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease;
}

.distance:hover {
    background: #1565c0;
    text-decoration: underline;
}

.site-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: 6px;
}

.site-details-heading {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
}

.site-details-layout {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-details-text {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.detail-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

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

.value {
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.875rem;
}

.site-rose-container {
    display: flex;
    justify-content: center;
    margin: 0.25rem 0;
}

.site-rose {
    display: block;
}

/* Flyability badges */
.flyability-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.flyability-great-xc {
    background: #a7f3d0;
    color: #065f46;
}

.flyability-some-xc {
    background: #d1fae5;
    color: #065f46;
}

.flyability-likely {
    background: #fde68a;
    color: #78350f;
}

.flyability-possibly {
    background: #fed7aa;
    color: #9a3412;
}

.flyability-not-flyable {
    background: #fee2e2;
    color: #991b1b;
}

/* Day rating block (optimal window + category scale) */
.day-rating {
    margin-bottom: 1rem;
}

.day-rating .peak-flying-time {
    margin-bottom: 0.75rem;
}

.legend-scale {
    display: flex;
    align-items: center;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
}

.legend-item {
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.legend-item.legend-active {
    flex: 3;
    padding: 0.6rem 0.5rem;
    font-size: 1rem;
}

.legend-item.legend-inactive {
    flex: 1;
    padding: 0.35rem 0.15rem;
    font-size: 0.6rem;
    opacity: 0.55;
}

@media (max-width: 600px) {
    .optimal-window-summary {
        flex-direction: column;
        align-items: flex-start;
    }
    .legend-item.legend-active {
        flex: 4;
        font-size: 0.9rem;
        padding: 0.5rem 0.3rem;
    }
    .legend-item.legend-inactive {
        flex: 1;
        font-size: 0;
        padding: 0.5rem 0;
        min-width: 12px;
    }
}

/* Weather info */
.weather-info {
    background: var(--bg-light);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.forecast-time {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.weather-section {
    margin-bottom: 0.75rem;
}

.weather-section:last-child {
    margin-bottom: 0;
}

.weather-section-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-dark);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.weather-row:last-child {
    margin-bottom: 0;
}

.weather-row.altitude-wind {
    padding-left: 0.5rem;
    font-size: 0.9em;
    color: var(--text-light);
}

.weather-row.cloudbase-row {
    background: linear-gradient(to right, #e0f2fe, transparent);
    padding: 0.35rem 0.5rem;
    margin: 0.25rem -0.5rem;
    border-radius: 4px;
    border-left: 3px solid #0ea5e9;
}

.cloudbase-value {
    font-weight: 600;
    color: #0369a1 !important;
}

.weather-label {
    color: var(--text-light);
    font-size: 0.875rem;
}

.weather-value {
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.875rem;
}

/* Flyability reasons and warnings */
.flyability-reasons {
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.flyability-reasons .reason {
    color: #166534;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.flyability-reasons .reason:last-child {
    margin-bottom: 0;
}

.flyability-warnings {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.flyability-warnings .warning {
    color: #92400e;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.flyability-warnings .warning:last-child {
    margin-bottom: 0;
}

.description {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.site-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.btn-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Feedback section */
.feedback-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.feedback-label {
    color: var(--text-light);
    font-size: 0.875rem;
}

.feedback-buttons {
    display: flex;
    gap: 0.25rem;
}

.feedback-btn {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #f3f4f6;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-agree:hover {
    background: #d1fae5;
    border-color: #10b981;
    transform: scale(1.1);
}

.feedback-disagree:hover {
    background: #fee2e2;
    border-color: #ef4444;
    transform: scale(1.1);
}

.feedback-thanks {
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 500;
}

.feedback-comment-box {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}

.feedback-comment-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    resize: vertical;
    min-height: 2.5rem;
}

.feedback-comment-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.feedback-comment-actions {
    display: flex;
    gap: 0.4rem;
}

.feedback-send-btn, .feedback-skip-btn {
    padding: 0.3rem 0.75rem;
    border-radius: 5px;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.feedback-send-btn {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.feedback-send-btn:hover {
    background: var(--primary-hover);
}

.feedback-skip-btn {
    background: white;
    color: var(--text-light);
}

.feedback-skip-btn:hover {
    background: var(--bg-light);
}

.no-results {
    text-align: center;
    color: var(--text-light);
    padding: 3rem 1rem;
    font-size: 1.1rem;
}

.no-results-container {
    text-align: center;
    padding: 2rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.no-results-container h3 {
    color: #991b1b;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.explanation-box {
    background: white;
    border-left: 4px solid #f59e0b;
    padding: 1.25rem;
    margin: 1.5rem auto;
    max-width: 600px;
    border-radius: 6px;
    text-align: left;
}

.explanation-box strong {
    color: var(--text-dark);
    font-size: 1rem;
}

.explanation-box p {
    margin: 0.5rem 0;
    color: var(--text-dark);
    line-height: 1.6;
}

.cheer-up {
    margin-top: 1rem !important;
    color: var(--primary-color) !important;
    font-weight: 500;
    font-style: italic;
}

.next-flyable-loading {
    margin-top: 2rem;
    padding: 2rem;
    text-align: center;
    background: white;
    border-radius: 8px;
    border: 2px dashed var(--primary-color);
}

.next-flyable-loading p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.next-flyable-window {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.next-flyable-window h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.next-time {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin: 0.5rem 0;
}

.hours-away {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0.25rem 0 1rem 0;
}

.distance-expanded {
    background: #fef3c7;
    color: #92400e;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0.5rem 0;
}

.sites-available {
    color: var(--text-dark);
    margin: 1rem 0 0.75rem 0;
    font-weight: 500;
}

.next-flyable-sites {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.mini-site-card {
    background: var(--bg-light);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    text-align: left;
    border-left: 3px solid var(--primary-color);
}

.mini-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.suggestion {
    margin-top: 1.5rem;
    padding: 0.75rem;
    background: #d1fae5;
    color: #065f46;
    border-radius: 6px;
    font-weight: 600;
}

.suggestion-btn {
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s;
}

.suggestion-btn:hover {
    background: var(--primary-hover);
}

.resignation-text {
    margin-top: 0.75rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    font-style: italic;
}

.no-windows {
    margin-top: 1rem;
    color: var(--text-light);
    font-style: italic;
}

/* Peak flying time */
.peak-flying-time {
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    color: #1f2937;
}

.peak-flying-time h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.peak-time {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.peak-info {
    font-size: 1rem;
    opacity: 0.7;
    margin: 0.25rem 0;
}

/* Flyable windows */
.flyable-windows-section {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.flyable-windows-section h4 {
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.flyable-window {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.flyable-window:last-child {
    margin-bottom: 0;
}

.flyable-window.best-window {
    border-color: #fbbf24;
    background: linear-gradient(to right, #fef3c7, white);
}

.window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.window-time {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.flyability-badge-small {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.window-weather {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.weather-row-compact {
    font-size: 0.875rem;
    color: var(--text-dark);
}


.btn-windy {
    color: #0ea5e9 !important;
}

.btn-windy:hover {
    color: #0284c7 !important;
}

footer {
    text-align: center;
    margin-top: 2rem;
    color: white;
    font-size: 0.9rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (max-width: 640px) {
    body {
        padding: 1rem 0.5rem;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 1rem;
    }

    .search-box {
        flex-direction: column;
    }

    .datetime-box {
        flex-direction: column;
        align-items: stretch;
    }

    .day-selector,
    #location-input,
    #search-btn {
        width: 100%;
    }

    .site-header {
        flex-direction: column;
    }

    .distance {
        align-self: flex-start;
    }

    .site-actions {
        flex-direction: column;
    }

    .site-card {
        padding: 1rem;
    }

    .flyable-windows-section {
        padding: 0.75rem;
    }

    .flyable-window {
        padding: 0.75rem;
    }

    .window-weather {
        gap: 0.25rem;
    }

    .weather-row-compact {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .site-details-layout {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-rose-container {
        align-self: center;
    }
}
