/* ==========================================================================
   Kosovo Weather - Main Stylesheet
   Mobile-first responsive design
   ========================================================================== */

/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ==========================================================================
   Header
   ========================================================================== */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.nav {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    position: relative;
    z-index: 101;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.875rem;
}

.nav-link:hover {
    background: var(--background);
    color: var(--primary-color);
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
}

/* ==========================================================================
   Main Content
   ========================================================================== */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

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

/* ==========================================================================
   SVG Map
   ========================================================================== */
.map-section {
    margin-bottom: 3rem;
}

.map-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    overflow: hidden;
}

#kosovo-map {
    width: 100%;
    height: auto;
    max-height: 70vh;
}

.kosovo-svg-map {
    width: 100%;
    height: auto;
    min-height: 400px;
    max-height: 70vh;
    display: block;
}

.municipality {
    stroke: #666;
    stroke-width: 1;
    cursor: pointer;
    transition: filter 0.2s ease, stroke-width 0.2s ease;
}

.municipality:hover {
    filter: brightness(0.9);
    stroke: #333;
    stroke-width: 2;
}

.municipality.active {
    filter: brightness(0.85);
    stroke: #1d4ed8;
    stroke-width: 2.5;
}

/* Weather icon on map */
.weather-map-icon {
    pointer-events: none;
}

.weather-map-icon image {
    width: 30px;
    height: 30px;
}

.weather-map-temp {
    font-size: 11px;
    font-weight: 700;
    fill: #1e293b;
    text-anchor: middle;
    pointer-events: none;
}

.map-label {
    font-size: 10px;
    font-weight: 600;
    fill: var(--text-primary);
    pointer-events: none;
    text-anchor: middle;
}

/* ==========================================================================
   Cities Grid
   ========================================================================== */
.cities-grid {
    margin-bottom: 2rem;
}

.cities-grid h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

.cities-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.city-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.city-link:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.city-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.city-link::before {
    content: '📍';
    font-size: 1rem;
}

/* ==========================================================================
   Weather Page
   ========================================================================== */
.weather-page {
    max-width: 900px;
    margin: 0 auto;
}

.weather-header {
    text-align: center;
    margin-bottom: 2rem;
}

.weather-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.weather-intro {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
}

/* Current Weather Card */
.current-weather {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: var(--radius);
    padding: 2rem;
    color: white;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.current-weather-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.current-weather-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    opacity: 0.9;
}

.weather-date {
    font-size: 0.875rem;
    opacity: 0.8;
}

.current-weather-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.weather-icon {
    width: 100px;
    height: 100px;
}

.weather-icon img {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.temperature {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
}

.temperature-unit {
    font-size: 2rem;
    font-weight: 400;
    opacity: 0.8;
}

.weather-description {
    font-size: 1.25rem;
    text-align: center;
    margin-bottom: 1.5rem;
    text-transform: capitalize;
}

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

.weather-detail {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
}

.weather-detail-label {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-detail-value {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Hourly Forecast Table */
.hourly-section {
    margin-bottom: 2rem;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.hourly-header {
    background: var(--primary-color);
    color: white;
    padding: 0.875rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hourly-date {
    font-size: 1rem;
    font-weight: 600;
}

.hourly-day {
    font-size: 1rem;
    font-weight: 500;
}

.hourly-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.hourly-table thead {
    background: var(--background);
}

.hourly-table th {
    padding: 0.625rem 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.hourly-table th:first-child {
    text-align: left;
    padding-left: 1rem;
    width: 60px;
}

.hourly-table th:nth-child(2) {
    text-align: left;
    width: 180px;
}

.hourly-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.hourly-table tbody tr:last-child {
    border-bottom: none;
}

.hourly-table tbody tr:hover {
    background: var(--background);
}

.hourly-table td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
    text-align: center;
}

.hourly-table td:first-child {
    text-align: left;
    padding-left: 1rem;
}

.hourly-table td:nth-child(2) {
    text-align: left;
}

.hourly-table .hourly-time {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.hourly-table .hourly-desc {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hourly-table .hourly-desc img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.hourly-table .hourly-desc span {
    font-size: 0.875rem;
    color: var(--text-primary);
    text-transform: capitalize;
}

.hourly-table .hourly-temp {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.hourly-table .hourly-precip,
.hourly-table .hourly-humidity,
.hourly-table .hourly-wind {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive hourly table */
@media (max-width: 768px) {
    .hourly-table th:nth-child(2) {
        width: 120px;
    }
    
    .hourly-table th,
    .hourly-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .hourly-table .hourly-desc img {
        width: 24px;
        height: 24px;
    }
    
    .hourly-table .hourly-desc span {
        font-size: 0.75rem;
    }
    
    .hourly-table .hourly-temp {
        font-size: 1rem;
    }
    
    .hourly-table .hourly-precip,
    .hourly-table .hourly-humidity,
    .hourly-table .hourly-wind {
        font-size: 0.75rem;
    }
}

/* 10-Day Forecast */
.forecast-section {
    margin-bottom: 2rem;
}

.forecast-section h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.forecast-card {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    text-align: center;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    width: 100%;
    max-width: 150px;
    margin: 0 auto;
    transition: all 0.2s ease;
}

.forecast-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.forecast-card.active {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.forecast-day {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.forecast-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.5rem;
}

.forecast-icon img {
    width: 100%;
    height: 100%;
}

.forecast-temp {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.forecast-temp-min {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.forecast-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    text-transform: capitalize;
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

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

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

/* Error State */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    color: #dc2626;
}

.error-message h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.error-message p {
    color: #991b1b;
}

/* City Not Found */
.not-found {
    text-align: center;
    padding: 4rem 2rem;
}

.not-found h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.not-found p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}


/* Forecast grid mobile responsive */
@media (max-width: 768px) {
    .forecast-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0.5rem;
        padding: 0 1rem;
        align-items: stretch;
    }
    
    .forecast-card {
        padding: 0.5rem;
        font-size: 0.875rem;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 120px;
    }
    
    .forecast-icon {
        width: 40px;
        height: 40px;
    }
    
    .forecast-temp {
        font-size: 0.875rem;
    }
    
    .forecast-desc {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .forecast-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0 1rem;
        align-items: stretch;
    }
    
    .forecast-card {
        padding: 0.5rem;
        font-size: 0.875rem;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 120px;
    }
    
    .forecast-icon {
        width: 40px;
        height: 40px;
        margin: 0 auto 0.5rem;
    }
    
    .forecast-day {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    .forecast-temp {
        font-size: 0.875rem;
    }
    
    .forecast-desc {
        font-size: 0.75rem;
    }
}

/* Climate Article */
.climate-article {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-top: 3rem;
    box-shadow: var(--shadow-sm);
}

.climate-article h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.climate-article h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 1rem 0;
}

.article-content p {
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-align: justify;
}

@media (max-width: 768px) {
    .climate-article {
        padding: 1.5rem;
        margin-top: 2rem;
    }
    
    .climate-article h2 {
        font-size: 1.25rem;
    }
    
    .climate-article h3 {
        font-size: 1.125rem;
    }
    
    .article-content p {
        font-size: 0.95rem;
        text-align: left;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* Climate Article */
.climate-article {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-top: 3rem;
    box-shadow: var(--shadow-sm);
}

.climate-article h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.climate-article h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 1rem 0;
}

.article-content p {
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-align: justify;
}

@media (max-width: 768px) {
    .climate-article {
        padding: 1.5rem;
        margin-top: 2rem;
    }
    
    .climate-article h2 {
        font-size: 1.25rem;
    }
    
    .climate-article h3 {
        font-size: 1.125rem;
    }
    
    .article-content p {
        font-size: 0.95rem;
        text-align: left;
    }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-note {
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet */
@media (min-width: 640px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .cities-list {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .weather-details {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .weather-header h1 {
        font-size: 2rem;
    }
}

/* Desktop */
@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
    
    .hero h1 {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .cities-list {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .map-container {
        padding: 2rem;
    }
    
    .map-label {
        font-size: 11px;
    }
    
    .current-weather {
        padding: 2.5rem;
    }
    
    .temperature {
        font-size: 5rem;
    }
    
    .weather-icon {
        width: 120px;
        height: 120px;
    }
}

/* Large Desktop */
@media (min-width: 1024px) {
    .cities-list {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .map-label {
        font-size: 12px;
    }
}

/* Mobile Landscape - Forecast */
@media (max-width: 639px) {
    .forecast-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0 1rem;
    }
    
    .forecast-card {
        padding: 0.5rem;
        font-size: 0.875rem;
        min-height: 120px;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .forecast-icon {
        width: 40px;
        height: 40px;
    }
    
    .forecast-day {
        font-size: 0.875rem;
    }
    
    .forecast-temp {
        font-size: 0.875rem;
    }
    
    .forecast-desc {
        font-size: 0.75rem;
    }
}

/* Small Mobile */
@media (max-width: 380px) {
    .cities-list {
        grid-template-columns: 1fr;
    }
    
    .temperature {
        font-size: 3rem;
    }
    
    .weather-icon {
        width: 80px;
        height: 80px;
    }
}

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

/* Cache indicator */
.cache-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--background);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.cache-indicator.fresh::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
}

.cache-indicator.cached::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--warning);
    border-radius: 50%;
}
