/* === Mint Green Dark Theme === */
:root {
    --background-dark: #1A1D21;
    --surface-color: #25282D;
    --surface-light: #34383E;
    
    --primary-accent: #66DDAA;   /* Mint Green */
    --secondary-accent: #48BFE5; /* Complementary Teal/Blue */
    --tertiary-accent: #FFC75F;  /* Warm Yellow/Orange */
    --error-color: #FF6B6B;

    --text-primary: #EAEAEA;
    --text-secondary: #A0A0A0;
    
    --font-family: 'Poppins', sans-serif;
}

/* === Base Styles & Layout === */
body {
    font-family: var(--font-family);
    margin: 0;
    background-color: #000;
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.mobile-prototype-wrapper {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    background: var(--background-dark);
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

main, #results-section {
    flex-grow: 1;
    overflow-y: auto;
}

.container {
    padding: 1.5rem;
    animation: fadeIn 0.5s ease-out;
}

.hidden { display: none !important; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* === Typography & Headers === */
header { text-align: center; margin-bottom: 2rem; }
h1 { font-weight: 700; font-size: 1.8rem; margin: 0 0 0.25rem 0; color: var(--text-primary); }
h2 {
    font-weight: 600; font-size: 1.2rem; margin: 0 0 1rem 0;
    color: var(--primary-accent); display: flex; align-items: center; gap: 0.5rem;
}
p { color: var(--text-secondary); margin: 0; }
.results-header p { font-size: 1rem; }
.results-header strong { color: var(--secondary-accent); font-weight: 500; }

/* === Forms & Inputs === */
.form-step { margin-bottom: 2rem; }
#search-container { position: relative; display: flex; gap: 0.5rem; margin-bottom: 1rem; }

input[type="text"], input[type="date"] {
    width: 100%; padding: 1rem; border-radius: 12px;
    border: 2px solid var(--surface-light); background-color: var(--surface-color);
    font-size: 1rem; font-family: var(--font-family); color: var(--text-primary);
    box-sizing: border-box; transition: border-color 0.3s, box-shadow 0.3s;
    flex-grow: 1;
}
input[type="text"]:focus, input[type="date"]:focus {
    outline: none; border-color: var(--primary-accent);
    box-shadow: 0 0 15px rgba(102, 221, 170, 0.3);
}
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.8); }

/* === Buttons === */
button {
    font-family: var(--font-family); cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s, background-color 0.3s;
}
.cta-button, #back-to-input-btn {
    width: 100%; padding: 1rem; border: none; border-radius: 999px;
    font-size: 1.1rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
}
.cta-button {
    background: var(--primary-accent); color: #121212;
    box-shadow: 0 4px 20px rgba(102, 221, 170, 0.3);
}
.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 221, 170, 0.4);
}
#back-to-input-btn { margin-top: 2rem; background: var(--surface-light); color: var(--text-primary); }

#get-location-btn {
    flex-shrink: 0; background: var(--surface-color); border: 2px solid var(--surface-light);
    color: var(--text-secondary); border-radius: 12px; width: 54px; height: 54px;
    display: flex; align-items: center; justify-content: center; padding: 0;
}
#get-location-btn:hover { border-color: var(--primary-accent); color: var(--primary-accent); }

/* === Map & Search Results === */
#map { height: 250px; width: 100%; border-radius: 16px; background-color: var(--surface-color); }
.leaflet-tile-pane { filter: grayscale(100%) invert(100%) contrast(80%); }
#search-results {
    position: absolute; width: calc(100% - 62px); top: 110%;
    background: var(--surface-color); border: 1px solid var(--surface-light);
    border-radius: 12px; box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    z-index: 1001; max-height: 200px; overflow-y: auto;
}
.search-result-item { padding: 0.8rem 1.2rem; cursor: pointer; transition: background-color 0.2s; }
.search-result-item:hover { background-color: var(--surface-light); }

/* === Loading Section === */
#loading-section {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(26, 29, 33, 0.9); backdrop-filter: blur(5px);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 1000; animation: fadeIn 0.3s;
}
.spinner {
    width: 50px; height: 50px; border-radius: 50%;
    background: conic-gradient(var(--primary-accent), var(--secondary-accent), var(--tertiary-accent), var(--primary-accent));
    animation: spin 1.5s linear infinite; margin-bottom: 1.5rem;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
.progress-bar-container { width: 70%; max-width: 300px; height: 8px; background: var(--surface-light); border-radius: 4px; overflow: hidden; margin-top: 1.5rem; }
.progress-bar { width: 0; height: 100%; background: var(--primary-accent); border-radius: 4px; transition: width 0.4s ease-out; }
.progress-bar.loading { width: 95%; transition: width 180s linear; } /* 3 minutes */
.progress-bar.finished { width: 100%; }

/* === Results Section: Tabs, Cards, Advanced === */
.tabs {
    display: flex; background-color: var(--surface-color);
    border-radius: 999px; padding: 0.5rem; margin: 2rem 0;
}
.tab-button {
    flex: 1; background: transparent; color: var(--text-secondary);
    padding: 0.75rem; font-size: 1rem; font-weight: 500; border: none; border-radius: 999px;
}
.tab-button.active {
    background: var(--primary-accent); color: #121212; font-weight: 600;
    box-shadow: 0 2px 10px rgba(102, 221, 170, 0.2);
}

#casual-content { display: flex; flex-direction: column; gap: 1rem; }
.weather-card {
    background: var(--surface-color); border: 1px solid var(--surface-light);
    border-radius: 20px; padding: 1.5rem; text-align: center;
}
.weather-card .icon { color: var(--primary-accent); margin-bottom: 0.5rem; }
.weather-card h3 { color: var(--text-primary); font-size: 1.25rem; margin: 0 0 0.5rem 0; }
.weather-card p { font-size: 1rem; color: var(--text-secondary); }

.advanced-variable-section { margin-bottom: 2.5rem; }
.advanced-variable-section h3 { font-size: 1.4rem; color: var(--secondary-accent); border-left: 3px solid var(--secondary-accent); padding-left: 1rem; margin-bottom: 1rem;}
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }
.stat-box { background: var(--surface-color); padding: 1rem; border-radius: 12px; text-align: center; }
.stat-box .label { font-size: 0.85rem; color: var(--text-secondary); }
.stat-box .value { font-size: 1.5rem; font-weight: 600; color: var(--text-primary); }
.stat-box .value span { font-size: 1rem; color: var(--text-secondary); }
h4 { margin: 2rem 0 1rem 0; color: var(--text-secondary); font-weight: 500; text-align: center; }
.chart-container { height: 200px; }

/* === Export Section === */
.export-container { position: relative; margin-top: 2rem; }
.export-main-button { display: flex; }
.export-main-button button {
    border: none;
    background: var(--primary-accent);
    color: #121212;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(102, 221, 170, 0.2);
    transition: transform 0.2s, box-shadow 0.3s;
}
.export-main-button button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 221, 170, 0.3);
}
.export-main-button button:first-child {
    flex-grow: 1; border-radius: 999px 0 0 999px; text-align: center;
}
.export-main-button button#export-options-toggle {
    padding: 1rem; border-radius: 0 999px 999px 0;
    border-left: 1px solid rgba(18, 18, 18, 0.15);
}
.export-dropdown {
    position: absolute; bottom: 110%; width: 100%;
    background-color: var(--surface-color); border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3); padding: 0.5rem;
    display: flex; flex-direction: column; animation: fadeIn 0.2s;
}
.export-dropdown a {
    color: var(--text-primary); text-decoration: none; padding: 0.75rem 1rem;
    border-radius: 8px; transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.export-dropdown a:hover { background-color: var(--surface-light); }

/* Added for PDF loading state */
.mini-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    border-top-color: var(--primary-accent);
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}
.export-dropdown a.loading-pdf {
    pointer-events: none;
    justify-content: center;
}