:root {
    /* Color Palette */
    --bg-base: #0f172a;
    /* Deep Slate */
    --bg-accent: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    /* Vibrant Blue */
    --accent-hover: #0ea5e9;
    --danger-color: #ef4444;

    /* Glassmorphism settings */
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-bg-hover: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-glow: 0 4px 30px rgba(0, 0, 0, 0.5);

    /* Radii & Shadows */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    position: relative;
    -webkit-font-smoothing: antialiased;
    font-size: 16px;
    /* Alap betűméret mobilon is stabil */
}

/* ========== ANIMÁLT HÁTTÉR ========== */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at top right, #1e1b4b 0%, #0f172a 60%);
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.35;
    animation: drift 25s infinite alternate ease-in-out;
}

.globe-1 {
    top: -10%;
    left: -5%;
    width: 40vw;
    height: 40vw;
    background: #4f46e5;
    animation-delay: 0s;
}

.globe-2 {
    bottom: -15%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: #0ea5e9;
    animation-delay: -5s;
}

.globe-3 {
    top: 30%;
    left: 30%;
    width: 30vw;
    height: 30vw;
    background: #e11d48;
    opacity: 0.15;
    animation-delay: -12s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(50px, -50px) scale(1.1);
    }

    100% {
        transform: translate(-30px, 40px) scale(0.95);
    }
}

/* ========== LAYOUT ========== */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 1;
    overflow-x: hidden;
    /* Megakadályozza a vízszintes görgetést */
}

/* ========== GLASS ALAPOSZTÁLY ========== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
}

.glass:hover {
    background: var(--glass-bg-hover);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ========== HEADER ========== */
header {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: slide-down 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

header h1 i {
    color: var(--accent-color);
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.highlight {
    font-weight: 300;
    color: var(--text-secondary);
}

/* Keresősáv és Vezérlők */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-container {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    padding: 0.5rem 0.5rem 0.5rem 1.5rem;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-width: 280px;
    width: 100%;
}

.search-container:focus-within {
    box-shadow: 0 0 0 2px var(--accent-color), 0 10px 25px rgba(0, 0, 0, 0.4);
    background: rgba(15, 23, 42, 0.8);
}

#city-input {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.05rem;
    outline: none;
    flex: 1;
    width: 100%;
}

#city-input::placeholder {
    color: #64748b;
}

#gps-btn, #search-btn {
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(56, 189, 248, 0.3);
    flex-shrink: 0;
    /* Megakadályozza a zsugorodást */
}

#gps-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#gps-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

#search-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(56, 189, 248, 0.5);
}

/* Autocomplete Dropdown */
.search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 100%;
    background: var(--glass-bg-hover);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.search-result-item {
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.search-result-item:hover {
    background: rgba(56, 189, 248, 0.15);
}

.search-result-item i {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.search-result-item .country {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-left: auto;
}

/* Mértékegység Váltó */
.unit-toggle {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    padding: 0.25rem;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.unit-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.unit-btn.active {
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    color: #fff;
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

/* Kedvencek */
.favorites-container {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: -0.5rem;
}

.favorite-chip {
    padding: 0.4rem 1rem;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 9999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Érintési terület növelése */
    min-height: 44px;
}

.favorite-chip:hover {
    background: rgba(56, 189, 248, 0.2);
    transform: translateY(-2px);
}

.remove-fav {
    color: var(--text-secondary);
    transition: color 0.2s;
    font-size: 0.8rem;
}

.remove-fav:hover {
    color: var(--danger-color);
}

/* ========== MAIN ========== */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 2rem;
    align-items: start;
}

.hidden {
    display: none !important;
}

/* ========== JELENLEGI IDŐJÁRÁS KÁRTYA ========== */
.current-weather-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fade-in 0.8s ease forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

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

.weather-hero {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 320px;
    position: relative;
    overflow: hidden;
}

.weather-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 2;
    position: relative;
    width: 100%;
}

.city-info h2 {
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -1px;
    word-break: break-word;
    /* Hosszú városnevek kezelése */
}

.city-info p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.favorite-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.favorite-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.05);
}

.favorite-btn.active {
    color: #facc15;
}

.hero-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2;
    margin-top: 1.5rem;
    position: relative;
    width: 100%;
}

.hero-temp {
    display: flex;
    flex-direction: column;
}

.large-temp {
    font-size: 6.5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(to bottom, #ffffff 30%, #94a3b8 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
}

.hero-desc {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--accent-color);
    text-transform: capitalize;
    margin-top: 0.5rem;
}

.hero-icon {
    font-size: 6rem;
    color: #fff;
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.5));
    animation: float-icon 6s infinite ease-in-out;
}

@keyframes float-icon {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* Metrika kártyák */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.metric-card {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-radius: var(--radius-md);
}

.metric-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    color: var(--accent-color);
    flex-shrink: 0;
}

.metric-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.metric-info .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-info .value {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== OLDALSÓ OSZLOP (ÓRÁS + 7 NAPOS) ========== */
.side-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

h3.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h3.section-title i {
    color: var(--accent-color);
    font-size: 1.1rem;
}

/* Órás előrejelzés */
.hourly-container {
    display: flex;
    overflow-x: auto;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

.hourly-container::-webkit-scrollbar {
    display: none;
}

.hourly-item {
    min-width: 85px;
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    scroll-snap-align: start;
}

.hourly-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-3px);
}

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

.hourly-icon {
    font-size: 1.6rem;
}

.hourly-temp {
    font-size: 1.1rem;
    font-weight: 600;
}

/* 7 napos előrejelzés */
.forecast-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.forecast-item,
.forecast-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0;
    transition: all 0.2s;
    gap: 0.5rem;
    cursor: pointer;
}

.forecast-card-container {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

.forecast-card-container:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.forecast-details {
    padding: 0 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: rgba(0, 0, 0, 0.15);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.forecast-details.open {
    max-height: 150px;
    padding: 0.8rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.details-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.details-row:last-child {
    margin-bottom: 0;
}

.forecast-date {
    width: 70px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
    font-size: 0.9rem;
}

.forecast-icon {
    font-size: 1.3rem;
    width: 35px;
    text-align: center;
}

.forecast-temps,
.forecast-temp {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.temp-min,
.min-temp {
    color: #64748b;
    font-weight: 500;
    width: 35px;
    text-align: right;
    font-size: 0.9rem;
}

.temp-bar-container {
    width: 50px;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

.temp-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #38bdf8, #818cf8);
}

.temp-max,
.max-temp {
    font-weight: 600;
    width: 35px;
    text-align: right;
    font-size: 0.9rem;
}

/* ========== BETÖLTŐ ÉS HIBAÜZENET ========== */
#loading,
#error {
    text-align: center;
    padding: 3rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

#error i {
    font-size: 2.5rem;
    color: var(--danger-color);
    margin-bottom: 1rem;
}

/* ========== IKON ANIMÁCIÓK ========== */
@keyframes spin-slow {
    100% { transform: rotate(360deg); }
}
.anim-spin-slow {
    animation: spin-slow 8s linear infinite;
    display: inline-block;
}

@keyframes float-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
.anim-float {
    animation: float-gentle 3s ease-in-out infinite;
    display: inline-block;
}

@keyframes pulse-rain {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.anim-pulse {
    animation: pulse-rain 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes flash-bolt {
    0%, 95%, 98% { color: inherit; text-shadow: none; }
    96%, 99% { color: #facc15; text-shadow: 0 0 15px rgba(250, 204, 21, 0.8); }
}
.anim-flash {
    animation: flash-bolt 4s infinite;
    display: inline-block;
}

/* ========== LÁBLÉC ========== */
footer {
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

footer .api-credit a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

footer .api-credit a:hover {
    text-decoration: underline;
}

/* ======================== */
/* ===== MOBIL NÉZET ====== */
/* ======================== */

@media (max-width: 992px) {
    .dashboard-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {

    /* Container padding csökkentése */
    .container {
        padding: 1rem;
        gap: 1.5rem;
    }

    /* Header */
    .header-top {
        flex-direction: column;
        align-items: stretch;
    }

    header h1 {
        font-size: 1.8rem;
        justify-content: center;
        text-align: center;
        width: 100%;
    }

    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper {
        max-width: none;
    }

    .search-container {
        min-width: 0;
        width: 100%;
    }

    .favorites-container {
        justify-content: center;
        width: 100%;
    }

    .favorite-chip {
        min-height: 40px;
    }

    /* Hero kártya */
    .weather-hero {
        padding: 1.5rem;
        min-height: auto;
    }

    .hero-header {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

    .city-info h2 {
        font-size: 1.8rem;
    }

    .hero-body {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        margin-top: 1rem;
    }

    .large-temp {
        font-size: 4rem;
    }

    .hero-desc {
        font-size: 1.2rem;
    }

    .hero-icon {
        font-size: 4rem;
        animation: none;
    }

    /* Metrika kártyák: 3 helyett 2 oszlop */
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.8rem;
    }

    .metric-card {
        padding: 0.75rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .metric-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .metric-info .value {
        font-size: 1.1rem;
    }

    /* Side column */
    .side-column {
        gap: 1.5rem;
    }

    /* Órás előrejelzés */
    .hourly-item {
        min-width: 70px;
        padding: 0.75rem 0.25rem;
    }

    .hourly-time {
        font-size: 0.8rem;
    }

    .hourly-icon {
        font-size: 1.4rem;
    }

    .hourly-temp {
        font-size: 1rem;
    }

    /* 7 napos előrejelzés – kompaktabb */
    .forecast-date {
        width: 60px;
        font-size: 0.85rem;
    }

    .forecast-icon {
        font-size: 1.2rem;
        width: 30px;
    }

    .temp-min,
    .temp-max,
    .min-temp,
    .max-temp {
        width: 30px;
        font-size: 0.85rem;
    }

    .temp-bar-container {
        width: 40px;
    }
}

@media (max-width: 480px) {

    /* Nagyon kicsi telefonok (max 480px) */
    .container {
        padding: 0.75rem;
        gap: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    /* Metrika kártyák: 1 oszlop */
    .metrics-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .metric-card {
        flex-direction: row;
        text-align: left;
        justify-content: flex-start;
        gap: 1rem;
    }

    .hero-icon {
        font-size: 3.5rem;
    }

    .large-temp {
        font-size: 3.5rem;
    }

    .hero-desc {
        font-size: 1rem;
    }

    /* Órás elemek még kisebbek */
    .hourly-item {
        min-width: 65px;
        padding: 0.5rem 0.25rem;
    }

    .hourly-time {
        font-size: 0.7rem;
    }

    .hourly-icon {
        font-size: 1.2rem;
    }

    .hourly-temp {
        font-size: 0.9rem;
    }

    /* 7 napos előrejelzés: sorok tördelése */
    .forecast-temps,
    .forecast-temp {
        justify-content: flex-end;
        gap: 0.3rem;
    }

    .temp-bar-container {
        width: 35px;
    }

    .forecast-date {
        width: 55px;
        font-size: 0.8rem;
    }
}