/* Dashboard CSS Grid Layout */

.dashboard-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* Lenis handles scrolling inside main */
    position: relative;
    z-index: 10;
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100vh;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 20;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
}

.sidebar-logo i {
    color: var(--color-secondary);
    font-size: 1.8rem;
}

.sidebar-nav {
    flex-grow: 1;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    font-family: var(--font-primary);
}

.nav-item i {
    font-size: 1.2rem;
    width: 20px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.sidebar-section {
    margin-top: 2rem;
    flex-grow: 2;
}

.section-heading {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-left: 1.25rem;
}

.fav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fav-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.fav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem 3rem 4rem 3rem;
    position: relative;
}

/* Top Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    width: 100%;
    max-width: 500px;
    z-index: 50;
}

.search-container input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 1rem;
}

.recent-searches {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    background: var(--color-bg-dark);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid var(--glass-border);
}

.recent-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.recent-item:hover {
    background: rgba(255,255,255,0.1);
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(56, 189, 248, 0.3);
    cursor: pointer;
}

/* Dashboard Grid Layout */
.dashboard-grid {
    position: relative;
    width: 100%;
}

.page-view {
    display: none;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(150px, auto);
    gap: 1.5rem;
    animation: fadeIn 0.4s ease forwards;
}

.page-view.active {
    display: grid;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.widget {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.widget-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.widget-title i {
    color: var(--color-secondary);
}

/* Specific Widgets */
.hero-widget {
    grid-column: span 8;
    grid-row: span 2;
    position: relative;
    overflow: hidden;
    padding: 2.5rem;
}

#hero-canvas-container {
    position: absolute;
    top: 0;
    right: -100px;
    width: 60%;
    height: 100%;
    z-index: 0;
    pointer-events: auto; /* Allow dragging earth */
}

.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.hero-city {
    font-family: var(--font-heading);
    font-size: 3rem;
    line-height: 1.1;
}

.hero-country {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.hero-time {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.hero-time span:first-child {
    font-size: 1.5rem;
    font-weight: 600;
}

.hero-time span:last-child {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.hero-main-temp {
    display: flex;
    align-items: baseline;
    gap: 2rem;
}

.hero-main-temp .temp {
    font-size: 6rem;
    font-weight: 800;
    font-family: var(--font-heading);
}

.hero-desc-group {
    display: flex;
    flex-direction: column;
}

.hero-desc-group .weather-icon-large {
    font-size: 2.5rem;
}
.hero-desc-group .description {
    font-size: 1.2rem;
    color: var(--color-secondary);
    text-transform: capitalize;
}

/* AQI Widget */
.aqi-widget {
    grid-column: span 4;
    grid-row: span 1;
}

.aqi-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.aqi-score {
    font-size: 3rem;
    font-weight: 800;
    color: #10b981; /* Default green */
}

.aqi-status {
    font-size: 1.2rem;
    font-weight: 600;
}

.aqi-details {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
}
.aqi-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.aqi-item span { font-size: 0.8rem; color: var(--text-secondary); }

/* Insights Widget */
.insights-widget {
    grid-column: span 4;
    grid-row: span 1;
}

.insights-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    height: 100%;
}

.insight-item {
    background: rgba(0,0,0,0.2);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    border-left: 3px solid var(--color-accent);
}

.skeleton {
    height: 40px;
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Details Grid */
.details-widget {
    grid-column: span 8;
    grid-row: span 1;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.detail-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 12px;
}
.detail-card i {
    font-size: 1.5rem;
    color: var(--color-secondary);
}
.detail-card .label { font-size: 0.85rem; color: var(--text-secondary); }
.detail-card .value { font-size: 1.1rem; font-weight: 600; }

/* Analytics Widget */
.analytics-widget {
    grid-column: span 8;
    grid-row: span 2;
}

.chart-container {
    width: 100%;
    height: 100%;
    position: relative;
    min-height: 400px;
}

#analytics-widget-full {
    grid-column: span 8;
    grid-row: span 4;
}

#insights-widget-full {
    grid-column: span 4;
    grid-row: span 4;
}

/* Map Widget */
.map-widget {
    grid-column: span 12;
    grid-row: span 4;
    padding: 0;
    overflow: hidden;
    position: relative;
    min-height: 60vh;
}
.map-widget .widget-title {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 1000;
    background: var(--glass-bg);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    backdrop-filter: var(--glass-blur);
}
.map-container {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Hourly Scroll */
.hourly-widget {
    grid-column: span 12;
    grid-row: span 1;
}
.hourly-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

/* Daily Widget */
.daily-widget {
    grid-column: span 8;
    grid-row: span 2;
}
.daily-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.daily-list .daily-item {
    background: rgba(0,0,0,0.2);
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Sun Path Widget */
.sun-widget {
    grid-column: span 4;
    grid-row: span 1;
}

.sun-path-container {
    position: relative;
    height: 100px;
    margin-top: 1rem;
}
.sun-times {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.time-block { display: flex; flex-direction: column; align-items: center; font-size: 0.9rem;}
.time-block i { color: #f59e0b; margin-bottom: 0.25rem;}

.sun-arc {
    width: 100%;
    height: 50px;
    border-top-left-radius: 100px;
    border-top-right-radius: 100px;
    border: 2px dashed rgba(255,255,255,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.5);
    position: relative;
}
.sun-orb {
    width: 20px;
    height: 20px;
    background: #f59e0b;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px #f59e0b;
    transition: left 1s ease, top 1s ease;
}
