/* 
   Bird Habitat Suitability Tool
   Main Stylesheet
   Created: May 15, 2025
   www.Human-Ai.Solutions
*/

/* ===== BASE STYLES ===== */
:root {
    /* Color palette based on environmental/bird conservation themes */
    --primary-color: #4CAF50;      /* Verdant Green */
    --secondary-color: #2196F3;    /* Serene Blue */
    --accent-color: #8BC34A;       /* Lime Green accent */
    --dark-color: #1B5E20;         /* Dark Green */
    --light-color: #E8F5E9;        /* Light Green background */
    --neutral-color: #F5F5F5;      /* Light Gray */
    --text-color: #212121;         /* Near Black for text */
    --text-light: #FFFFFF;         /* White text */
    --footer-bg: #333333;          /* Dark Gray for footer */
    --error-color: #F44336;        /* Red for errors */
    --focus-color: #BBDEFB;        /* Light blue for focus states */
    --border-color: #BDBDBD;       /* Medium Gray for borders */
    
    /* Score category colors (accessible color scheme) */
    --excellent-color: #388E3C;    /* Dark Green */
    --good-color: #7CB342;         /* Medium Green */
    --fair-color: #FFA000;         /* Amber */
    --poor-color: #E64A19;         /* Deep Orange */
    
    /* Chart colors */
    --chart-grid: #CCCCCC;
    --chart-line: #757575;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--neutral-color);
    font-size: 16px;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

h1 {
    font-size: 1.8rem;
}

h2 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--dark-color);
    text-decoration: underline;
}

/* ===== HEADER ===== */
header {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 1.5rem 0;
    text-align: center;
}

header h1 {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.tagline {
    font-style: italic;
    opacity: 0.9;
}

.logo-container {
    margin-bottom: 1rem;
}

.logo {
    max-width: 200px;
    height: auto;
    border-radius: 5px;
}

/* ===== NAVIGATION ===== */
nav {
    background-color: var(--dark-color);
    padding: 0.5rem 0;
}

nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

nav li {
    margin: 0.5rem 0;
}

nav a {
    color: var(--text-light);
    padding: 0.5rem 1rem;
    display: block;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

nav a:hover, nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

/* ===== MAIN CONTENT ===== */
main {
    padding: 2rem 0;
}

section {
    background-color: var(--light-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* ===== FORM STYLES ===== */
.input-form {
    background-color: var(--neutral-color);
    border-radius: 6px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.input-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
}

.input-section {
    display: none;
}

.input-section.active {
    display: block;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-color);
    outline: none;
}

.help-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #666;
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
}

.primary-button,
.secondary-button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

.primary-button {
    background-color: var(--primary-color);
    color: var(--text-light);
}

.primary-button:hover {
    background-color: var(--dark-color);
    transform: translateY(-1px);
}

.secondary-button {
    background-color: var(--secondary-color);
    color: var(--text-light);
}

.secondary-button:hover {
    background-color: #1976D2;
    transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active {
    transform: translateY(1px);
}

/* For screen readers only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===== RESULTS STYLES ===== */
.results-container {
    margin-top: 2rem;
}

.results-placeholder {
    background-color: var(--neutral-color);
    border: 2px dashed var(--secondary-color);
    border-radius: 6px;
    padding: 2rem;
    text-align: center;
    margin: 1.5rem 0;
}

/* Loading indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--light-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Results actions */
.results-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.results-actions .secondary-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon {
    font-size: 1.2rem;
}

/* Location info */
.location-info {
    background-color: var(--neutral-color);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.location-info h3 {
    width: 100%;
    margin-bottom: 1rem;
}

.location-info p {
    margin-bottom: 0.5rem;
    margin-right: 1.5rem;
}

/* Overall score */
.overall-score {
    background-color: var(--neutral-color);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1.5rem 0;
}

.score-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.score-bar {
    width: 100%;
    max-width: 300px;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.score-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-out;
}

.score-category {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.confidence-level {
    font-style: italic;
    margin-bottom: 1rem;
    color: #666;
}

.score-description {
    text-align: left;
    line-height: 1.6;
}

/* Category colors */
.category-excellent .score-fill {
    background-color: var(--excellent-color);
}

.category-good .score-fill {
    background-color: var(--good-color);
}

.category-fair .score-fill {
    background-color: var(--fair-color);
}

.category-poor .score-fill {
    background-color: var(--poor-color);
}

.category-excellent .score-category {
    color: var(--excellent-color);
}

.category-good .score-category {
    color: var(--good-color);
}

.category-fair .score-category {
    color: var(--fair-color);
}

.category-poor .score-category {
    color: var(--poor-color);
}

/* Visualization section */
.visualization-section {
    background-color: var(--neutral-color);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-container {
    position: relative;
    height: 300px;
    margin: 1.5rem 0;
}

.chart-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.chart-tab {
    background: none;
    border: 2px solid var(--secondary-color);
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-tab.active {
    background-color: var(--secondary-color);
    color: var(--text-light);
}

.chart-tab:hover {
    background-color: rgba(33, 150, 243, 0.1);
}

/* KPI scores */
.kpi-scores {
    margin-top: 2rem;
}

.kpi-score {
    background-color: var(--neutral-color);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kpi-score:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.kpi-score h4 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.kpi-score .score-value {
    font-size: 1.2rem;
    margin-left: 1rem;
}

.kpi-score .score-bar {
    margin-bottom: 1rem;
}

.kpi-score .score-explanation {
    font-size: 0.95rem;
    line-height: 1.5;
}

.kpi-score .data-source {
    font-size: 0.85rem;
    margin-top: 1rem;
    color: #666;
}

.kpi-score .data-source a {
    text-decoration: underline;
}

/* Recommendations */
.recommendations {
    background-color: var(--neutral-color);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.recommendations ul {
    list-style-type: none;
    margin-left: 0;
}

.recommendations li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    padding-left: 2rem;
}

.recommendations li:last-child {
    border-bottom: none;
}

.recommendations li::before {
    content: '✓';
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Data sources */
.data-sources {
    background-color: var(--neutral-color);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.data-sources ul {
    list-style-type: none;
    margin-left: 0;
    columns: 1;
}

.data-sources li {
    padding: 0.5rem 0;
}

.scientific-basis {
    font-style: italic;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

/* Map container */
.map-container {
    height: 300px;
    border-radius: 6px;
    overflow: hidden;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
}

/* Print styles */
@media print {
    nav, .input-form, .form-actions, .results-actions, footer {
        display: none !important;
    }
    
    body, .container, section {
        background-color: white !important;
        color: black !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .chart-container {
        page-break-inside: avoid;
    }
    
    .kpi-score {
        page-break-inside: avoid;
    }
    
    a {
        text-decoration: underline;
        color: black !important;
    }
    
    .score-fill {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* ===== FOOTER ===== */
footer {
    background-color: var(--footer-bg);
    color: var(--text-light);
    padding: 2rem 0;
    margin-top: 2rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
}

footer a {
    color: var(--accent-color);
}

footer a:hover {
    color: var(--text-light);
}

.copyright, .date, .attribution {
    margin-bottom: 0.5rem;
}

/* ===== RESPONSIVE DESIGN ===== */
/* Tablet and larger */
@media (min-width: 768px) {
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
    nav ul {
        flex-direction: row;
        justify-content: center;
    }
    
    nav li {
        margin: 0 0.5rem;
    }
    
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
    
    .form-actions {
        justify-content: flex-start;
    }
    
    .data-sources ul {
        columns: 2;
    }
    
    .chart-container {
        height: 400px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    h1 {
        font-size: 2.5rem;
    }
    
    header {
        text-align: left;
    }
    
    .logo-container {
        float: left;
        margin-right: 2rem;
    }
    
    header .container {
        display: flex;
        align-items: center;
    }
    
    header .container > div:first-child {
        margin-right: 2rem;
    }
    
    nav ul {
        justify-content: flex-start;
    }
    
    #coordinates-input {
        display: flex;
        gap: 1.5rem;
    }
    
    #coordinates-input .form-group {
        flex: 1;
    }
    
    .data-sources ul {
        columns: 3;
    }
    
    .chart-container {
        height: 450px;
    }
}

/* ===== ACCESSIBILITY ===== */
:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #006400;
        --secondary-color: #0000CD;
        --accent-color: #008000;
        --text-color: #000000;
        --text-light: #FFFFFF;
    }
}

/* ===== FORM VALIDATION STYLES ===== */
input:invalid {
    border-color: var(--error-color);
}

input:invalid:focus {
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.2);
}

input.error {
    border-color: var(--error-color);
}

.form-group.has-error label {
    color: var(--error-color);
}