@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #090d16;
    --bg-secondary: #111827;
    --glass-bg: rgba(17, 24, 39, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.12);
    
    --color-primary: #10b981; /* Emerald Grass */
    --color-primary-glow: rgba(16, 185, 129, 0.35);
    --color-primary-dark: #059669;
    
    --color-sky: #3b82f6; /* Blue for rain/humidity */
    --color-sun: #fbbf24; /* Sun Amber */
    
    --color-success: #10b981; /* Perfect */
    --color-warning: #f59e0b; /* Caution / Moderate */
    --color-danger: #ef4444; /* Poor / Wet */
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.2);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.08) 0%, transparent 45%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

header {
    padding: 2rem 1.5rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.05em;
    cursor: pointer;
}

.brand-accent {
    color: var(--color-primary);
    text-shadow: 0 0 15px var(--color-primary-glow);
}

.brand-icon {
    width: 32px;
    height: 32px;
    color: var(--color-primary);
    filter: drop-shadow(0 0 8px var(--color-primary-glow));
    animation: wave-grass 4s ease-in-out infinite alternate;
}

@keyframes wave-grass {
    0% { transform: rotate(-5deg) skewX(-2deg); }
    100% { transform: rotate(10deg) skewX(5deg); }
}

main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem 4rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glassmorphic Panel Base */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 2rem;
    transition: var(--transition);
}

/* Search Area */
.search-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 10;
}

.search-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-title-row h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #a7f3d0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-box-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.search-input-group {
    position: relative;
    flex: 1;
}

.search-icon-inside {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    pointer-events: none;
    transition: var(--transition);
}

.search-input {
    width: 100%;
    padding: 1.1rem 1rem 1.1rem 3.25rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

.search-input:focus + .search-icon-inside {
    color: var(--color-primary);
}

/* Autocomplete Suggestions */
.suggestions-box {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    max-height: 250px;
    overflow-y: auto;
    z-index: 999;
    display: none;
}

.suggestion-item {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--glass-hover);
}

.suggestion-item:hover .suggestion-primary {
    color: var(--color-primary);
}

.suggestion-item svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.suggestion-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.suggestion-primary {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    transition: var(--transition);
}

.suggestion-secondary {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Dynamic button layout */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.75rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--bg-primary);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    background: #34d399;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--glass-hover);
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.btn-pulse {
    animation: btn-glow-pulse 2s infinite alternate;
}

@keyframes btn-glow-pulse {
    0% {
        box-shadow: 0 0 5px rgba(16, 185, 129, 0.2);
    }
    100% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    }
}

/* Spinner & Status info */
.status-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3.5px solid rgba(255, 255, 255, 0.1);
    border-top: 3.5px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.current-location-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--color-primary);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    max-width: 250px;
}

.current-location-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

/* Dashboard Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.dashboard-grid > * {
    min-width: 0;
}

.hero-card > *, .timeline-card > * {
    min-width: 0;
}

.dashboard-grid.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Large Hero Card: Best Mowing Slot */
.hero-card {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(17, 24, 39, 0.8) 100%);
    border: 1px solid rgba(16, 185, 129, 0.25);
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--color-primary-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

.hero-recommendation-details {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
}

.badge-best {
    background: linear-gradient(90deg, var(--color-primary) 0%, #34d399 100%);
    color: var(--bg-primary);
    text-transform: uppercase;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    align-self: flex-start;
}

.best-time-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.best-time-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
}

.comfort-insights {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.insight-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
}

.insight-pill svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.insight-pill.good svg { color: var(--color-success); }
.insight-pill.warning svg { color: var(--color-warning); }
.insight-pill.info svg { color: var(--color-sky); }

/* Circular Gauge Container */
.hero-gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.gauge-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
}

.gauge-svg {
    transform: rotate(-90deg);
}

.gauge-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 14;
}

.gauge-fill {
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 14;
    stroke-linecap: round;
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 1s ease-out;
}

.gauge-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-score {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-main);
}

.gauge-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.gauge-rating {
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 0 10px var(--color-primary-glow);
}

/* 3-Day Cards Layout */
.three-day-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.day-card {
    cursor: pointer;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition);
}

.day-card:hover {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
}

.day-card.active {
    border-color: var(--color-primary);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, rgba(17, 24, 39, 0.8) 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.day-title {
    font-weight: 700;
    font-size: 1.15rem;
}

.day-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.day-weather-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.day-temp {
    font-size: 1.75rem;
    font-weight: 800;
}

.day-pop {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--color-sky);
    font-weight: 600;
}

.day-suitability-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    align-self: flex-start;
    text-transform: uppercase;
}

.suitability-excellent {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.suitability-moderate {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.suitability-poor {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Interactive Hourly Timeline Card */
.timeline-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.timeline-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timeline-header-row h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.timeline-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.excellent { background-color: var(--color-success); }
.legend-dot.moderate { background-color: var(--color-warning); }
.legend-dot.poor { background-color: var(--color-danger); }

/* Horizontal scrolling timeline container */
.timeline-wrapper {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
}

.timeline-grid {
    display: flex;
    min-width: 650px;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.hour-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    cursor: pointer;
    padding: 0.75rem 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 1px solid transparent;
}

.hour-column:hover {
    background: rgba(255, 255, 255, 0.04);
}

.hour-column.active {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.35);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.hour-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.hour-bar-container {
    height: 120px;
    width: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.hour-bar-fill {
    width: 100%;
    border-radius: 6px;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hour-bar-fill.excellent { background: var(--color-success); }
.hour-bar-fill.moderate { background: var(--color-warning); }
.hour-bar-fill.poor { background: var(--color-danger); }

.hour-score-lbl {
    font-size: 0.75rem;
    font-weight: 700;
}

.hour-temp-lbl {
    font-size: 0.8rem;
    font-weight: 500;
}

.hour-icon-wrapper svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

/* Selected hour details popup in panel */
.hour-details-panel {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: none;
    margin-top: 1rem;
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.hour-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

.hour-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
}

.detail-metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-metric-value {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Custom tips list */
.lawn-tips {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tip-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.tip-icon {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.tip-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.tip-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.tip-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Footer Section */
footer {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
    background: rgba(9, 13, 22, 0.8);
}

footer a {
    color: var(--color-primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Alert Reason inside Hour details inspector */
.detail-reason-alert {
    margin-top: 1.25rem;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slide-up-fade 0.3s ease-out;
}

@keyframes slide-up-fade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.detail-reason-alert svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5px;
    flex-shrink: 0;
}

.detail-reason-alert.alert-warn {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: var(--color-warning);
}

.detail-reason-alert.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--color-danger);
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .glass-panel {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }
    
    .hero-card {
        padding: 1.5rem;
    }
    
    .best-time-title {
        font-size: 1.6rem;
    }
}

@media(min-width: 768px) {
    header {
        padding: 3rem 2rem 2rem 2rem;
    }
    
    main {
        gap: 3rem;
        padding: 0 2rem 5rem 2rem;
    }
    
    footer {
        padding: 4rem 2rem;
    }
    
    .search-container {
        flex-direction: row;
        align-items: center;
    }
    
    .search-title-row {
        flex: 0 0 auto;
    }
    
    .search-box-wrapper {
        flex-direction: row;
        flex: 1;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hero-card {
        grid-template-columns: 2fr 1fr;
        padding: 3rem;
    }
    
    .three-day-container {
        grid-column: span 1;
    }
    
    .timeline-card {
        grid-column: span 2;
    }
    
    .lawn-tips-card {
        grid-column: 1 / -1;
    }
}
