:root {
    --primary: #1A56DB;
    --primary-light: #3F83F8;
    --primary-dim: #E1EFFE;
    --accent: #FF8A4C;
    --bg: #F3F4F6;
    --bg-card: #FFFFFF;
    --text: #111827;
    --text-light: #6B7280;
    --border: #E5E7EB;
    --radius: 20px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
    
    --table-header: #F9FAFB;
    --table-hover: #F3F4F6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Nunito Sans', 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

.container {
    max-width: 1250px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header & Search */
.header {
    background-color: var(--bg-card);
    box-shadow: var(--shadow);
    padding: 12px 0;
    margin-bottom: 25px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.logo h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.logo .accent { color: var(--accent); }
.logo p { font-size: 12px; color: var(--text-light); font-weight: 600; display: none; /* Hide on tight phones */ }
@media(min-width: 480px){ .logo p { display: block; } }

.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-input-group {
    display: flex;
    align-items: center;
    background: #F3F4F6;
    border: 2px solid transparent;
    border-radius: 50px;
    padding: 2px 6px;
    transition: all 0.3s ease;
}

.search-input-group:focus-within {
    background: #FFF;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(63, 131, 248, 0.15);
}

.search-icon { padding-left: 12px; color: var(--text-light); display: flex; align-items: center; }

.search-input {
    flex: 1; border: none; background: transparent; padding: 10px; font-size: 15px; font-weight: 600; outline: none; color: var(--text); width: 100%;
}
.search-input::placeholder { color: #9CA3AF; }

.geo-btn {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 50%; color: var(--primary);
    cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.05); flex-shrink: 0;
}
.geo-btn:hover { background: var(--primary); color: #FFF; border-color: var(--primary); }

.search-results {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 15px 40px rgba(0,0,0,0.12);
    display: none; max-height: 350px; overflow-y: auto; z-index: 1000;
}
.search-item {
    padding: 14px 15px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 15px; display: flex; flex-direction: column;
}
.search-item .admin { font-size: 12px; color: var(--text-light); margin-top: 3px; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background-color: #F9FAFB; color: var(--primary); }

/* Main Location Title */
.main-loc-title {
    font-size: 28px; font-weight: 800; color: var(--text); margin-bottom: 15px; text-transform: capitalize; padding: 0 5px;
}

/* Quick Tabs Component */
.quick-tabs-section { margin-bottom: 25px; }
.tabs-scroll-container {
    display: flex; gap: 12px; overflow-x: auto; padding-bottom: 5px; 
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}
.tabs-scroll-container::-webkit-scrollbar { display: none; }

.qt-card {
    min-width: 105px; background: var(--bg-card); border-radius: 16px; padding: 12px; text-align: center;
    box-shadow: var(--shadow); border: 2px solid var(--border); flex-shrink: 0; cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.qt-card:hover { transform: translateY(-2px); border-color: #D1D5DB; }
.qt-card.active { border-color: var(--primary); background: var(--primary-dim); box-shadow: 0 4px 12px rgba(26, 86, 219, 0.15);}
.qt-card.active .qt-temps { color: var(--primary); }

.qt-day { font-size: 14px; font-weight: 800; margin-bottom: 2px; }
.qt-date { font-size: 11px; color: var(--text-light); margin-bottom: 6px;}
.qt-icon { font-size: 26px; margin-bottom: 6px; line-height: 1; }
.qt-temps { font-size: 14px; font-weight: 800; color: var(--text); }
.qt-temps span.min { color: var(--text-light); margin-right: 4px; font-size: 12px;}
.qt-temps span.max { color: inherit; }

/* Cards Defaults */
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 25px; overflow: hidden; border: 1px solid var(--border); }

.panel-head { padding: 20px 25px; border-bottom: 1px solid var(--border); background: #FFF; }
.panel-head h3 { color: var(--text); font-size: 18px; font-weight: 800; }
.panel-head p { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* Hourly Detailed Panel (Sinoptik Style) */
.hourly-card { border: 2px solid transparent; box-shadow: var(--shadow); }
.hourly-header { padding: 15px 25px; background: var(--bg-card); border-bottom: 1px solid var(--border); }
.hourly-header h3 { color: var(--text); font-size: 16px; font-weight: 800; }
.hourly-responsive { width: 100%; overflow-x: auto; background: #FFF; -webkit-overflow-scrolling: touch;}

.tbl-hourly { width: 100%; min-width: 600px; border-collapse: collapse; text-align: center; font-size: 14px;}
.tbl-hourly th, .tbl-hourly td { padding: 12px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tbl-hourly th:last-child, .tbl-hourly td:last-child { border-right: none; }
.tbl-hourly tr{ transition: background 0.1s; }
.tbl-hourly tr:hover td { background: #FAFAFA; }

.tbl-hourly tr.time-row th { font-weight: 800; color: var(--text); font-size: 14px; background: #FFF; border-bottom: 2px solid var(--border);}
.tbl-hourly .h-icon { font-size: 24px; }
.tbl-hourly .h-temp { font-weight: 800; font-size: 16px; color: var(--text); }
.tbl-hourly .h-val { font-weight: 700; color: var(--text); }
.tbl-hourly tr.row-lbl th {text-align: left; background: var(--table-header); color: var(--text-light); font-weight: 600; font-size: 12px;}

/* Sticky left column for hourly */
.tbl-hourly th:first-child, .tbl-hourly td:first-child {
    position: sticky; left: 0; z-index: 2; width: 120px; min-width: 120px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.03); border-right: 2px solid var(--border);
}
.tbl-hourly thead th:first-child { background: #FFF; z-index: 3;}
.tbl-hourly tbody th:first-child { background: #F9FAFB; }

/* Current Board styling */
.current-board { display: flex; flex-direction: column; }
.board-header { padding: 20px 25px 0 25px; border-bottom: none; }
.main-temp-wrapper { padding: 15px 25px 20px 25px; display: flex; align-items: center; gap: 15px; }
.temp-huge { font-size: 52px; font-weight: 800; color: var(--primary); line-height: 1; letter-spacing: -1px; }
.temp-desc { display: flex; align-items: center; gap: 8px; }
.desc-icon { font-size: 32px; }
.desc-text { font-size: 18px; color: var(--text-light); font-weight: 700; }

.precise-metrics { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 25px 25px 25px; gap: 15px; }
.p-metric { display: flex; align-items: center; background: #F9FAFB; border-radius: 12px; padding: 12px 15px; border: 1px solid var(--border); }
.p-icon { font-size: 22px; margin-right: 12px; }
.p-data { display: flex; flex-direction: column; }
.p-val { font-weight: 800; font-size: 15px; color: var(--text); }
.p-lbl { font-size: 11px; color: var(--text-light); margin-top: 2px; font-weight: 600;}


/* Eco grid */
.eco-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; padding: 25px; }
.eco-tile { border-radius: 14px; padding: 20px; color: #FFF; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 4px 15px rgba(0,0,0,0.1);}
.eco-tile.good { background: linear-gradient(135deg, #10B981, #059669); }
.eco-tile.fair { background: linear-gradient(135deg, #F59E0B, #D97706); }
.eco-tile.poor { background: linear-gradient(135deg, #EF4444, #DC2626); }
.eco-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 800; font-size: 16px; opacity: 0.95;}
.eco-val { font-size: 38px; font-weight: 800; line-height: 1; margin-bottom: 8px; }
.eco-labels { display: flex; gap: 8px; margin-top: 15px; flex-wrap: wrap;}
.e-lbl { background: rgba(0,0,0,0.25); padding: 5px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 5px; border: 1px solid rgba(255,255,255,0.1);}

/* HUGE Charts */
.charts-grid-large { display: grid; grid-template-columns: 1fr; gap: 30px; padding: 25px; }
.chart-box-large { background: #FFF; border-radius: 16px; }
.chart-box-large h4 { font-size: 16px; color: var(--text); margin-bottom: 15px; font-weight: 800; }
.chart-wrapper-massive { position: relative; height: 350px; width: 100%; }

/* Detailed Table */
.agro-table { width: 100%; min-width: 800px; border-collapse: collapse; text-align: left; font-size: 14px; }
.agro-table th { background-color: var(--table-header); color: var(--text-light); font-weight: 700; padding: 15px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.agro-table td { padding: 15px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.agro-table tbody tr:hover td { background-color: var(--table-hover); }

/* Detailed table sticky col */
.agro-table th.sticky-col, .agro-table td.sticky-col { position: sticky; left: 0; z-index: 2; box-shadow: 2px 0 5px rgba(0,0,0,0.03); background: #FFF;}
.agro-table th.sticky-col { background-color: var(--table-header); z-index: 3; border-right: 1px solid var(--border); }
.agro-table tbody tr:hover .sticky-col { background-color: var(--table-hover); }

.t-date { display: flex; flex-direction: column; }
.t-day { font-size: 15px; font-weight: 800; color: var(--text); }
.t-month { font-size: 12px; color: var(--text-light); }
.t-code { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px;}
.t-high { color: #EF4444; font-weight: 800; }
.t-low { color: #3B82F6; font-weight: 700; }
.t-val { font-weight: 700; }

/* Radar */
.radar-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; }
.radar-controls { display:flex; gap: 8px; }
.rc-btn { padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor:pointer; background: #F3F4F6; color: var(--text); border: 1px solid var(--border); font-weight: 700; transition: all 0.2s;}
.rc-btn.active { background: var(--primary); color: #FFF; border-color: var(--primary); }

/* Loader */
.initial-loader {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 9999; text-align: center; padding: 20px;
}
.initial-loader h2 { font-size: 20px; margin-top: 20px; color: var(--primary); font-weight: 800;}
.initial-loader p { font-size: 14px; color: var(--text-light); margin-top: 10px; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top: 4px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.footer { text-align: center; padding: 15px 0 30px 0; color: var(--text-light); font-size: 13px; font-weight: 600;}

/* Super Optimization for Tablets & Phones */
@media (max-width: 1024px) {
    .precise-metrics { grid-template-columns: repeat(2, 1fr); padding: 0 20px 20px 20px;}
    .chart-wrapper-massive { height: 300px; }
}

@media (max-width: 768px) {
    .header-inner { flex-direction: row; flex-wrap: nowrap; gap: 10px;}
    .logo h1 { font-size: 20px; }
    .search-input { font-size: 14px; padding: 10px; }
    
    .main-loc-title { font-size: 24px; }
    .qt-card { min-width: 95px; padding: 10px; }
    
    .panel-head { padding: 15px; }
    .board-header { padding: 15px; }
    .main-temp-wrapper { padding: 10px 15px; }
    .charts-grid-large { padding: 15px; gap: 20px;}
    
    .radar-head { flex-direction: column; align-items: flex-start; }
    .radar-controls { display: flex; flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 5px; }
}

@media (max-width: 480px) {
    .header-inner { flex-direction: column; align-items: stretch;}
    .search-container { max-width: 100%; }
    
    /* On small phones, precise metrics become app-like square tiles */
    .precise-metrics { grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 15px 15px 15px; }
    .p-metric { flex-direction: column; text-align: center; padding: 15px 10px; justify-content: center;}
    .p-icon { margin: 0 0 5px 0; font-size: 24px; }
    .p-lbl { font-size: 11px; }

    .temp-huge { font-size: 48px; }
    .desc-icon { font-size: 28px; }
    .desc-text { font-size: 16px; }

    .tbl-hourly th, .tbl-hourly td { padding: 10px 4px; font-size: 13px;}
    .tbl-hourly th:first-child, .tbl-hourly td:first-child { width: 100px; min-width: 100px; font-size: 12px;}
    .tbl-hourly .h-temp { font-size: 15px; }
    
    .chart-wrapper-massive { height: 250px; }
}
