:root {
    --color-brand: #347a4b;
    --color-brand-light: #7ccf92;
    --color-brand-dark: #255f38;
    --color-heading: #263b2d;
    --color-text: #354b3b;
    --color-muted: #5f7064;
    --color-subtle: #f3faf5;
    --color-border: #d9e8de;
    --radius-card: 14px;
    --radius-control: 8px;
    --shadow-card: 0 12px 30px rgba(28, 76, 45, 0.10);
}

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

*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(124, 207, 146, 0.16), transparent 34rem),
        #f6fbf7;
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header */
.header {
    background:
        linear-gradient(135deg, #2f7447 0%, #4c9a61 52%, #82d996 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 12px rgba(28, 76, 45, 0.16);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
}

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

.logo-icon {
    font-size: 2rem;
    color: #fff;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: bold;
}

.logo-tagline {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 0.2rem;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.hero-section {
    text-align: center;
    margin-bottom: 3rem;
    background:
        linear-gradient(135deg, rgba(236, 250, 240, 0.94), rgba(249, 253, 250, 0.72));
    border: 1px solid rgba(185, 218, 194, 0.62);
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(28, 76, 45, 0.08);
    padding: 2.25rem 1.5rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--color-heading);
    margin-bottom: 1rem;
}

.hero-description {
    font-size: 1rem;
    color: var(--color-muted);
    margin-bottom: 0.75rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 10px;
    transition: transform 0.3s ease;
    color: var(--color-text);
}

.feature:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2rem;
    color: var(--color-brand);
    margin-bottom: 0.5rem;
}

.feature-text {
    font-size: 0.9rem;
    color: var(--color-muted);
    text-align: center;
}

/* Form Card */
.form-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 2rem;
    box-shadow: var(--shadow-card);
    max-width: 800px;
    margin: 0 auto;
}

.form-card[hidden] {
    display: none !important;
}

.stepper-step {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

/* #step4 is the last visible step; :last-of-type is unreliable because
   #programmaticFormFields (hidden) follows it in the DOM. */
#step4.stepper-step {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 1.5rem;
}

.form-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.form-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-heading);
}

.form-icon {
    color: var(--color-brand);
    font-size: 1.5rem;
}

/* Form Fields */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--color-heading);
}

.form-input,
.form-select,
textarea,
input,
select,
button {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-control);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-select {
    background-color: white;
    cursor: pointer;
}

input[type="date"].form-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 1rem;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(63, 122, 83, 0.12);
}

.form-hint {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--color-muted);
    line-height: 1.35;
}

/* Pill toggle / segmented control */
.pill-toggle {
    display: inline-flex;
    border: 2px solid var(--color-border);
    border-radius: 999px;
    overflow: hidden;
    background: #f3faf5;
}

.pill-toggle__option {
    position: relative;
    cursor: pointer;
}

.pill-toggle__option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pill-toggle__option span {
    display: block;
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-muted);
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
    user-select: none;
    white-space: nowrap;
}

.pill-toggle__option input[type="radio"]:checked + span {
    background: var(--color-brand);
    color: #fff;
    font-weight: 600;
}

.pill-toggle__option:hover input[type="radio"]:not(:checked) + span {
    background: #e3f0e8;
    color: var(--color-heading);
}

.pill-toggle__option input[type="radio"]:focus-visible + span {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

/* Destination cards */
.destination-card-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.destination-card-section {
    border: none;
    margin: 0;
    padding: 0;
}

.destination-card-section legend {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
    padding: 0;
}

.destination-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.destination-card {
    display: block;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.destination-card:hover {
    border-color: #b7d5c0;
    box-shadow: 0 5px 16px rgba(28, 76, 45, 0.07);
}

.destination-card.disabled {
    cursor: not-allowed;
    background: var(--color-subtle);
    border-color: #e0e4e8;
    opacity: 0.78;
}

.destination-card.disabled:hover {
    border-color: #e0e4e8;
    box-shadow: none;
}

.destination-card.selected {
    border-color: var(--color-brand);
    background: #f0faf3;
    box-shadow: 0 0 0 3px rgba(52, 122, 75, 0.13);
}

.destination-card-action {
    display: block;
    font-size: 0.82rem;
    color: #5f6f64;
    line-height: 1.35;
}

.destination-card.selected .destination-card-title::after {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #d9f4e0;
    color: var(--color-brand-dark);
    font-size: 0.7rem;
    font-weight: 700;
    vertical-align: middle;
}

.destination-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.destination-card-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-weight: 600;
    color: var(--color-heading);
    margin-bottom: 0.25rem;
}

.destination-card-meta {
    display: block;
    font-size: 0.8rem;
    color: var(--color-muted);
}

.destination-card-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #fbefd9;
    color: #7a5a21;
    font-size: 0.7rem;
    font-weight: 700;
    vertical-align: middle;
}

/* Preview coverage note */
.preview-coverage-note {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-muted);
}

.helper-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.helper-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid #dce5df;
    border-radius: 999px;
    background: #f2faf4;
    color: #4f5f54;
    font-size: 0.74rem;
    font-weight: 650;
    line-height: 1.1;
    padding: 0.18rem 0.5rem;
}

/* Footer */
.site-footer {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding: 1.5rem 2rem 2.5rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-muted);
    line-height: 1.5;
}

.site-footer .footer-copyright {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.4rem;
}

.site-footer a {
    color: var(--color-brand-dark);
}

/* Species Input */
.species-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.species-input {
    flex: 1;
}

.add-species-btn {
    background: var(--color-brand);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-control);
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.add-species-btn:hover {
    background: var(--color-brand-dark);
}

.species-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.species-tag {
    background: var(--color-brand);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.remove-species {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.remove-species:hover {
    background: rgba(255,255,255,0.2);
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-brand);
}

.checkbox-label {
    font-size: 1rem;
    color: var(--color-heading);
    cursor: pointer;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
}

.form-checkbox-label--section {
    margin: 1.5rem 0 0.75rem;
    color: var(--color-brand-dark);
}

.disclosure-toggle {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    padding: 0.75rem 0;
    margin: 0.75rem 0 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-brand-dark);
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
}

.disclosure-toggle:hover {
    color: var(--color-brand);
}

.disclosure-chevron {
    margin-left: 0.5rem;
    font-size: 0.9rem;
}

.form-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--color-brand);
}

.evidence-scope-disclosure {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    color: var(--color-muted);
}

/* API Key Section */
.api-key-group {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.api-key-input {
    flex: 1;
}

.save-api-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.save-api-btn:hover {
    background: #0056b3;
}

.api-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.info-icon {
    color: #007bff;
    font-size: 1rem;
}

.api-link {
    color: #007bff;
    text-decoration: none;
}

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

.trip-planning-notes {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: #f4f8f5;
    border: 1px solid #d7e6dc;
}

.trip-planning-notes h4 {
    margin: 0 0 0.5rem;
    color: var(--color-brand-dark);
    font-size: 0.95rem;
}

.trip-planning-notes ul {
    margin: 0;
    padding-left: 1.25rem;
}

.form-section-title {
    margin: 1.5rem 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-brand-dark);
}

.form-section-title:first-child {
    margin-top: 0;
}

.form-subsection-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-heading);
    letter-spacing: 0.01em;
}

.advanced-options {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    background: var(--color-subtle);
}

.advanced-options-summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--color-brand-dark);
}

.advanced-options-body {
    margin-top: 1rem;
}

/* Submit Button */
.submit-section {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.submit-btn {
    background: linear-gradient(135deg, var(--color-brand), var(--color-brand-light));
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 122, 75, 0.28);
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .features {
        flex-direction: column;
        align-items: center;
    }

    .form-card {
        padding: 1.5rem;
    }

    .species-input-group {
        flex-direction: column;
    }

    .api-key-group {
        flex-direction: column;
        align-items: stretch;
    }

    .header-content {
        padding: 0 1rem;
    }
}

@media (max-width: 420px) {
    .main-content {
        padding: 0.85rem;
    }

    .form-card {
        padding: 1rem;
    }

    .submit-btn {
        width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Loading Animation */
.loading {
    display: none;
    text-align: center;
    margin-top: 1rem;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--color-brand);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success Message */
.success-message {
    display: none;
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid #c3e6cb;
}

.results-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #f0f0f0;
}

.report-overview {
    background: #f8faf9;
    border: 1px solid #e2e9e5;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.meta-pill {
    background: #f3f6f4;
    color: #3d5244;
    border: 1px solid #dce5df;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
}

.hotspot-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-left: 3px solid #9ab8a3;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(32, 45, 37, 0.05);
}

.hotspot-card h4 {
    color: var(--color-heading);
    margin-bottom: 0.35rem;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    height: auto;
    background: #f3f6f4;
    color: #3d5244;
    border: 1px solid #dce5df;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 650;
    margin-left: 0.5rem;
    padding: 0.18rem 0.55rem;
}

.score-badge-subtle {
    min-width: auto;
    height: auto;
    padding: 0.2rem 0.55rem;
    background: #f3f6f4;
    color: #3d5244;
    border: 1px solid #dce5df;
    font-size: 0.78rem;
    font-weight: 650;
}

.general-ranking-details {
    margin: 0.5rem 0;
    color: #3d5244;
}

.general-ranking-details p {
    margin: 0.25rem 0;
}

.general-ranking-details p + p {
    color: #5f6f64;
    font-size: 0.9rem;
}

.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 0.5rem;
    margin: 1rem 0;
}

.evidence-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.65rem;
    border: 1px solid #edf0ee;
}

.evidence-item strong {
    display: block;
    color: var(--color-heading);
    font-size: 1.05rem;
}

.species-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.species-card {
    background: #fbfcfb;
    border: 1px solid #e7ece8;
    border-radius: 8px;
    padding: 0.85rem;
}

.timing-hint {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-brand-dark);
    background: #e8f4ec;
    border: 1px solid #c3ddc8;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    margin-left: 0.25rem;
    vertical-align: middle;
    white-space: nowrap;
}

.timing-hint--muted {
    color: var(--color-muted);
    background: #f3f4f2;
    border-color: #d5d9d6;
}

.species-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.species-links a {
    color: var(--color-brand-dark);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
}

.species-name-link {
    color: var(--color-brand-dark);
    text-decoration: none;
    font-weight: 700;
}

.species-name-link:hover {
    text-decoration: underline;
}

.hotspot-title-link {
    color: inherit;
    text-decoration: none;
}

.hotspot-title-link:hover,
.hotspot-title-link:focus {
    text-decoration: underline;
}

.prep-bird-list {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.8rem;
}

.prep-bird {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid #dfece4;
    border-radius: 999px;
    background: #fbfdfb;
}

.prep-bird-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
}

.prep-bird-title,
.prep-bird-name {
    color: #1f3d2a;
    font-weight: 700;
}

.prep-bird-label {
    background: #eef7f1;
    border: 1px solid #d5e9dc;
    color: #3f6f4d;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.1;
    padding: 0.14rem 0.42rem;
}

.prep-links {
    font-size: 0.78rem;
    white-space: nowrap;
}

.prep-bird-empty {
    margin: 0;
}

@media (max-width: 520px) {
    .prep-bird {
        align-items: flex-start;
        border-radius: 14px;
        flex-direction: column;
    }

    .prep-links {
        white-space: normal;
    }
}

.limitations {
    background: #fff8e8;
    border: 1px solid #f1dda8;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.limitations ul {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.limitations li {
    display: grid;
    grid-template-columns: 0.9em 1fr;
    column-gap: 0.4rem;
    align-items: start;
    margin-bottom: 0.45rem;
}

.limitations li::before {
    content: "•";
    line-height: inherit;
    color: #a0834b;
}

@media (max-width: 520px) {
    .limitations {
        padding: 0.75rem;
        font-size: 0.88rem;
    }

    .limitations h4 {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }
}

.region-card-list {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.region-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-left: 3px solid #9ab8a3;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 4px 12px rgba(32, 45, 37, 0.05);
}

.error-panel {
    background: #f8d7da;
    border: 1px solid #f1b0b7;
    border-radius: 8px;
    padding: 1rem;
}
