/* ==========================================================================
   TYRGI.EE LÕPLIK, TÄIELIK JA PUHASTATUD STIILILEHT
   ========================================================================== */

/* 1. VÄRVIMUUTUJAD JA ÜLDINE SEADISTUS */
:root {
    /* Hele teema (vaikimisi) */
    --background-color: #f8f9fa;
    --card-background: #FFFFFF;
    --text-color: #2c3e50;
    --gray-text: #7f8c8d;
    --border-color: #eef0f3;
    --header-border-color: #e0e0e0;
    --turkish-red: #E30A17;
    --pure-white: #FFFFFF;
    --hover-background: #f1f1f1;
}
body[data-theme="dark"] {
    /* Tume teema */
    --background-color: #121212;
    --card-background: #1e1e1e;
    --text-color: #e0e0e0;
    --gray-text: #999;
    --border-color: #333;
    --header-border-color: #2a2a2a;
    --hover-background: #252525;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    padding: 2rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.container { width: 100%; max-width: 1200px; margin: 0 auto; }

/* 2. PÄIS JA NAVIGATSIOON */
header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 1rem; margin-bottom: 2rem; border-bottom: 2px solid var(--header-border-color); flex-wrap: wrap; gap: 1rem; }
.logo-area { display: flex; align-items: center; gap: 0.8rem; }
.logo-area a { line-height: 0; }
.logo-text h1 a { text-decoration: none; color: inherit; }
.logo-image { height: 2.8rem; width: auto; }
.logo-area h1 { font-size: 2.5rem; font-weight: 700; color: var(--turkish-red); margin: 0; }
.logo-area .slogan { font-size: 1rem; color: var(--gray-text); margin-top: -5px; }
.header-controls { display: flex; align-items: center; gap: 1.5rem; margin-left: auto; }
.theme-toggle-button { background: none; border: 2px solid var(--border-color); border-radius: 30px; width: auto; height: 40px; cursor: pointer; display: flex; align-items: center; padding: 0 5px; transition: all 0.2s ease; }
.theme-toggle-button:hover { background-color: var(--hover-background); border-color: var(--gray-text); }
.theme-option { display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.theme-option svg { width: 20px; height: 20px; fill: var(--text-color); flex-shrink: 0; }
.theme-option span { font-weight: 500; color: var(--text-color); }
.dark-mode-option { display: none; }
.light-mode-option { display: flex; }
body[data-theme="dark"] .light-mode-option { display: none; }
body[data-theme="dark"] .dark-mode-option { display: flex; }
.datetime-area { text-align: right; }
.time, .time-single { font-size: 2.2rem; font-weight: 600; color: var(--text-color); }
.single-clock-label, .clock-label { font-size: 0.9rem; color: var(--gray-text); }
.dual-clocks-wrapper { display: flex; gap: 1.5rem; margin-bottom: 5px; justify-content: flex-end; align-items: center; }
.time-small { font-size: 1.5rem; font-weight: 600; color: var(--text-color); line-height: 1.2; }
#time-tr { color: var(--turkish-red); }
.date { font-size: 1rem; color: var(--gray-text); }

/* 3. AVALEHT (index.php) */
.grid-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.grid-item { aspect-ratio: 1 / 1; background-color: var(--turkish-red); color: var(--pure-white); display: flex; flex-direction: column; justify-content: center; align-items: center; text-decoration: none; gap: 0.5rem; padding: 1rem; border-radius: 15px; box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1); cursor: pointer; transition: all 0.3s ease-in-out; }
.grid-item:hover { transform: translateY(-5px) scale(1.05); box-shadow: 0 15px 25px rgba(227, 10, 23, 0.3); background-color: #c0010f; }
.grid-item-label { font-size: 1.1rem; font-weight: 500; text-transform: uppercase; text-align: center; }
.grid-item-data { font-size: 1.5rem; font-weight: 700; }
.grid-item-context { font-size: 0.8rem; font-weight: 400; opacity: 0.8; text-transform: none; }
.grid-item-icon { width: 40px; height: 40px; }
.grid-item-icon svg { width: 100%; height: 100%; fill: var(--pure-white); }

/* 4. ÜLDISED LEHE- JA KOMPONENDISTIILID */
.page-title { font-size: 2rem; font-weight: 600; margin-bottom: 2rem; color: var(--text-color); }
.contact-intro { text-align: center; font-size: 1.1rem; color: var(--gray-text); margin-bottom: 3rem; max-width: 700px; margin-left: auto; margin-right: auto;}
.section-title-small { font-size: 1.4rem; margin-top: 2.5rem; margin-bottom: 1.5rem; color: var(--text-color); }
.content-section, .about-page-container, .language-container, .calendar-container { background-color: var(--card-background); padding: 2rem; border-radius: 20px; border: 1px solid var(--border-color); box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
.important-box { background-color: #fff9e6; border: 1px solid #ffe699; border-left: 5px solid #ffc107; border-radius: 10px; padding: 1.5rem; margin: 3rem 0; }
body[data-theme="dark"] .important-box { background-color: #332b00; border-color: #665a2d; }
.info-box { background-color: #e7f3ff; border: 1px solid #b3d7ff; border-left: 5px solid #007bff; }
body[data-theme="dark"] .info-box { background-color: #1c293f; border-color: #3b5a9d; }
.tabs { overflow: hidden; border-bottom: 2px solid var(--border-color); margin-bottom: 2rem; }
.tab-link { background-color: transparent; border: none; outline: none; cursor: pointer; padding: 14px 16px; transition: 0.3s; font-size: 1rem; font-weight: 500; color: var(--gray-text); }
.tab-link:hover { background-color: var(--hover-background); }
.tab-link.active { color: var(--turkish-red); border-bottom: 2px solid var(--turkish-red); }
.tab-content { display: none; }
.accordion-item { border-bottom: 1px solid var(--border-color); }
.accordion-header { background-color: var(--hover-background); color: var(--text-color); cursor: pointer; padding: 18px; width: 100%; border: none; text-align: left; font-size: 1.1rem; font-weight: 600; }
.accordion-header::after { content: '+'; font-size: 1.3rem; color: var(--gray-text); float: right; }
.accordion-header.active::after { content: "−"; }
.accordion-panel { padding: 1rem 1.5rem; background-color: var(--card-background); max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }

/* 5. LEHESPETSIIFILISED STIILID */
/* --- ILM.PHP (LÕPLIK JA PARANDATUD) --- */
.weather-page-wrapper { max-width: 1100px; margin: 0 auto; }
.city-selector-area {
    background-color: var(--card-background);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}
.search-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.search-input {
    flex-grow: 1;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}
.search-input:focus {
    outline: none;
    border-color: var(--turkish-red);
    box-shadow: 0 0 0 4px rgba(227, 10, 23, 0.1);
}
.search-button {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    background-color: var(--turkish-red);
    color: var(--pure-white);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.search-button:hover {
    background-color: #c0010f;
    transform: translateY(-2px);
}
.popular-cities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}
.city-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    background-color: var(--hover-background);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.city-button:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}
.city-button.active {
    background-color: var(--turkish-red);
    color: var(--pure-white);
    border-color: var(--turkish-red);
    box-shadow: 0 4px 10px rgba(227, 10, 23, 0.25);
    font-weight: 600;
}

.forecast-wrapper { background-color: var(--card-background); padding: 2rem; border-radius: 20px; border: 1px solid var(--border-color); box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
.forecast-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; } /* AINULT ÜKS VEERG */

.forecast-card { /* ... (see osa on korras) ... */ }
.card-details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.8rem 1.5rem; /* Paindlik grid */ }

.hourly-forecast-container { max-height: 0; overflow: hidden; transition: all 0.5s ease-in-out; }
.forecast-card.active .hourly-forecast-container { max-height: 1000px; /* Piisavalt suur, et kogu sisu mahuks */ padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--border-color); }

/* UUS VERTIKAALNE TUNNIPROGNOOSI STIIL */
.hourly-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.hourly-list-item {
    display: grid;
    grid-template-columns: 80px 50px 80px 1fr; /* Kellaaeg, ikoon, temp, kirjeldus */
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}
.hourly-list-item:last-child { border-bottom: none; }
.hourly-list-item img { width: 40px; height: 40px; }
.hourly-time { font-weight: 600; }
.hourly-temp { font-weight: 600; text-align: right; }
.hourly-condition { color: var(--gray-text); padding-left: 1rem; text-align: right;}

/* KOGU MOBIILIVAATE PARANDUS ON SIIN */
@media (max-width: 768px) {
    .forecast-grid { grid-template-columns: 1fr; }
    .card-details-grid { grid-template-columns: 1fr; gap: 0.5rem; text-align: left; }
    .card-primary-info { flex-direction: row; align-items: center; }
}

/* KOGU MOBIILIVAATE PARANDUS ON SIIN */
@media (max-width: 768px) {
    .forecast-grid { grid-template-columns: 1fr; }
    .card-details-grid { grid-template-columns: 1fr; gap: 0.5rem; text-align: left; }
    .card-primary-info { flex-direction: row; align-items: center; } /* Taastame normaalse paigutuse */
}

/* RATES.PHP */
.currency-card-new {
    background: linear-gradient(145deg, var(--card-background) 0%, var(--hover-background) 100%);
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.07);
    border: 1px solid var(--border-color);
    padding: 2rem;
    max-width: 500px;
    margin: 2rem auto;
}
body[data-theme="dark"] .currency-card-new { background: linear-gradient(145deg, #2a2a2a 0%, #1e1e1e 100%); }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.currency-pair { font-size: 1.5rem; font-weight: 600; color: var(--text-color); display: flex; align-items: center; gap: 0.5rem; }
.currency-pair .flag { font-size: 1.8rem; }
.currency-pair .flag-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    vertical-align: middle;
}
.source-info { font-size: 0.9rem; color: var(--gray-text); text-align: right; }
.rate-line-new { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem; border-radius: 15px; margin-bottom: 1rem; }
.rate-direction { display: flex; align-items: center; gap: 0.8rem; font-size: 1rem; font-weight: 500; color: var(--gray-text); }
.rate-direction .fa-solid { font-size: 1.2rem; }
.rate-value-new { font-size: 2rem; font-weight: 700; color: var(--text-color); font-family: 'Courier New', Courier, monospace; }
.rate-line-new.buy { background-color: #e6ffed; }
.rate-line-new.buy .fa-solid { color: #28a745; }
body[data-theme="dark"] .rate-line-new.buy { background-color: rgba(40, 167, 69, 0.1); }
.rate-line-new.sell { background-color: #fff5f5; }
.rate-line-new.sell .fa-solid { color: var(--turkish-red); }
body[data-theme="dark"] .rate-line-new.sell { background-color: rgba(227, 10, 23, 0.1); }
.card-footer-new { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-color); font-size: 0.85rem; color: var(--gray-text); line-height: 1.6; display: flex; justify-content: space-between; flex-wrap: wrap; }
.card-footer-new span { display: block; }

.explanation-box {
    max-width: 600px; margin: 2rem auto 0 auto; padding: 1.5rem;
    background-color: var(--hover-background); border-radius: 15px;
    border: 1px solid var(--border-color); display: flex;
    gap: 1.5rem; align-items: flex-start;
}
.explanation-box .fa-solid { font-size: 1.8rem; color: var(--gray-text); margin-top: 5px; }
.explanation-box p { margin: 0; line-height: 1.7; font-size: 0.9rem; color: var(--gray-text); }

/* JALUS */
.site-footer { background-color: var(--turkish-red); color: var(--pure-white); padding: 2rem 0; margin-top: 3rem; text-align: center; }
.footer-quote { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.2); }
.quote-original { margin: 0 0 0.25rem 0; font-size: 1.2rem; font-style: italic; font-weight: 500; }
.quote-translation { margin: 0; font-size: 0.9rem; opacity: 0.8; }
.footer-copyright p { margin: 0; font-size: 0.8rem; opacity: 0.7; }

/* 6. SKALEERITAVUS */
@media (max-width: 992px) {
    .grid-container { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    body { padding: 1rem; }
    
    header {
        flex-direction: column; 
        align-items: center;    
        gap: 1.5rem;            
    }
    .header-controls {
        width: 100%;
        flex-direction: column; 
        align-items: center;    
        gap: 1.5rem;            
        margin-left: 0;         
    }
    .datetime-area { text-align: center; }
    
    .grid-container { grid-template-columns: repeat(2, 1fr); }
    .forecast-grid { grid-template-columns: 1fr; }
    .image-right { float: none; display: block; margin: 0 auto 2rem auto; max-width: 100%; }
    .calendar-controls { justify-content: center; }
    .filter-selector { order: -1; width: 100%; margin-bottom: 1rem; }

    /* PARANDUS: ILMAKAARDI DETAILID MOBIILIS */
    .card-details-grid {
        grid-template-columns: 1fr; /* Üks veerg */
        gap: 0.5rem; /* Väiksem vahe ridade vahel */
        text-align: center; /* Joondame teksti keskele */
    }
}
@media (max-width: 480px) {
    /* spetsiifilised stiilid väga väikestele ekraanidele */
}
@media (max-width: 768px) {
    .forecast-grid { grid-template-columns: 1fr; }
    .card-details-grid { grid-template-columns: 1fr; gap: 0.5rem; text-align: left; }
    .card-primary-info { flex-direction: row; align-items: center; }
}