:root {
    --bg-main: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --primary-color: #14b8a6;
    /* Teal 500 */
    --primary-hover: #0d9488;
    /* Teal 600 */
    --primary-light: #f0fdfa;
    /* Teal 50 */
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-btn: 0 10px 15px -3px rgb(20 184 166 / 0.3);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #f0fdfa 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 3rem;
    line-height: 1.5;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-content {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

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

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .main-grid {
        grid-template-columns: 2fr 3fr;
    }
}

/* Cards shared */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.card-header h2 {
    font-size: 0.9rem;
    font-weight: 700;
}

.indicator {
    width: 6px;
    height: 16px;
    border-radius: 9999px;
}

.color-teal {
    background: linear-gradient(to bottom, #2dd4bf, #10b981);
}

.color-blue {
    background: linear-gradient(to bottom, #60a5fa, #14b8a6);
}

.color-orange {
    background: linear-gradient(to bottom, #fb923c, #f59e0b);
}

/* Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 1.25rem;
}

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

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.value-highlight {
    color: var(--primary-color);
    font-weight: 700;
    font-family: monospace;
    font-size: 0.875rem;
}

.label-hint {
    font-weight: 400;
}

.hint-text {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Inputs visual */
.pseudo-input,
input[type="number"] {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s;
}

input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.pseudo-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pseudo-input.disabled {
    background-color: #f1f5f9;
    color: var(--text-secondary);
    cursor: not-allowed;
}

.badge {
    font-size: 0.625rem;
    background: #e2e8f0;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-weight: 700;
}

.coordinates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.coordinates-grid .pseudo-input {
    font-family: monospace;
    color: var(--primary-hover);
    background-color: var(--primary-light);
    border-color: #ccfbf1;
}

/* Range slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.625rem;
    color: var(--text-secondary);
    font-family: monospace;
    padding: 0 4px;
    margin-top: 0.25rem;
}

/* Button */
.predict-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(to right, #14b8a6, #10b981);
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-btn);
    transition: all 0.3s;
    margin-top: 1rem;
}

.predict-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 15px 20px -5px rgb(20 184 166 / 0.4);
}

.predict-btn:disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none;
}

.spinner {
    animation: spin 1s linear infinite;
}

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

.validation-hint {
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.75rem;
}

/* Map area */
.map-section {
    display: flex;
    flex-direction: column;
}

.map-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

#map {
    width: 100%;
    height: 320px;
    z-index: 1;
    /* Keep leaflet under overlap */
}

.map-overlay {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.625rem;
    font-family: monospace;
    padding: 2px 8px;
    border-radius: 6px;
    pointer-events: none;
}

/* Results section */
.results-section {
    margin-top: 2.5rem;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

.results-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.results-header h2 {
    font-size: 1rem;
    font-weight: 700;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Result Cards structure */
.result-card {
    position: relative;
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.result-card:hover {
    box-shadow: var(--shadow-md);
}

.card-bg-blob {
    position: absolute;
    top: -1.5rem;
    right: -1.5rem;
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    opacity: 0.1;
    filter: blur(16px);
}

.result-icon-header {
    margin-bottom: 1rem;
}

.icon-box {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.huge-value {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
}

.unit {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

.result-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.result-desc {
    font-size: 0.625rem;
    color: #94a3b8;
}

/* Distinct card themes */
.temp-card {
    border-color: #ffedd5;
    background: #fff8f1;
}

.temp-card .card-bg-blob {
    background: linear-gradient(to right, #fb923c, #ef4444);
}

.temp-card .icon-box {
    background: linear-gradient(to bottom right, #fb923c, #ef4444);
}

.temp-card .huge-value {
    color: #ea580c;
}

.wind-card {
    border-color: #e0f2fe;
    background: #f0f9ff;
}

.wind-card .card-bg-blob {
    background: linear-gradient(to right, #60a5fa, #06b6d4);
}

.wind-card .icon-box {
    background: linear-gradient(to bottom right, #60a5fa, #06b6d4);
}

.wind-card .huge-value {
    color: #2563eb;
}

.precip-card {
    border-color: #ccfbf1;
    background: #f0fdfa;
}

.precip-card .card-bg-blob {
    background: linear-gradient(to right, #2dd4bf, #10b981);
}

.precip-card .icon-box {
    background: linear-gradient(to bottom right, #2dd4bf, #10b981);
}

.precip-card .huge-value {
    color: #0d9488;
}

.results-metadata {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 1.5rem;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}

.toast {
    background: #1e293b;
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: toastPop 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.error {
    background: #ef4444;
}

.toast.success {
    background: #10b981;
}

@keyframes toastPop {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

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

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