/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; }

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --accent: #f59e0b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
    --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --card-bg: #1e293b;
        --text: #f1f5f9;
        --text-muted: #94a3b8;
        --border: #334155;
        --primary-light: #1e1b4b;
        --shadow: 0 1px 3px rgba(0,0,0,.3);
        --shadow-lg: 0 4px 6px -1px rgba(0,0,0,.4);
    }
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ===== Layout ===== */
.container {
    width: 100%;
    max-width: 97%;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== Header ===== */
.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    top: 0;
    padding: 1em 0 1em 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,.85);
}

@media (prefers-color-scheme: dark) {
    .site-header { background: rgba(15,23,42,.85); }
}

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

.logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text);
    font-weight: 700;
    font-size: 1.25rem;
}
.logo:hover { text-decoration: none; }
.logo-img { border-radius: 8px; }

.location-greeting {
    font-size: .875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.location-area {
    display: flex;
    align-items: center;
    gap: .5rem;
    position: relative;
    flex-shrink: 0;
}

.loc-set-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: .75rem;
    cursor: pointer;
    text-decoration: underline dotted;
    padding: 0;
}
.loc-set-btn:hover { color: var(--primary-hover); }

.loc-form {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .75rem;
    gap: .5rem;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    margin-top: .5rem;
    align-items: center;
}
.loc-form.open { display: flex; }

.loc-form input {
    padding: .4rem .6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .85rem;
    background: var(--bg);
    color: var(--text);
    width: 120px;
}
.loc-form input:focus { outline: none; border-color: var(--primary); }

.loc-form button {
    padding: .4rem .8rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: .8rem;
    cursor: pointer;
    white-space: nowrap;
}
.loc-form button:hover { background: var(--primary-hover); }

.loc-reset {
    font-size: .78rem;
    color: var(--text-muted);
}

/* ===== Cards ===== */
.card {
    max-width:600px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card h1, .card h2 {
    font-size: 1.25rem;
    margin: 0 0 .5rem 0;
    font-weight: 600;
}

/* ===== Hero / URL Shortener ===== */
.hero-card {
    text-align: center;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, var(--primary-light), var(--card-bg));
    border-color: var(--primary);
}

.hero-card h1 {
    font-size: 1.75rem;
    margin-bottom: .25rem;
}

.hero-sub {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: .95rem;
}

.shorten-form {
    display: flex;
    gap: .5rem;
    max-width: 600px;
    margin: 0 auto;
}

.shorten-form input[type="url"] {
    flex: 1;
    padding: .75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color .2s;
    min-width: 0;
}

.shorten-form input[type="url"]:focus {
    outline: none;
    border-color: var(--primary);
}

.shorten-form button {
    padding: .75rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s;
    white-space: nowrap;
}

.shorten-form button:hover { background: var(--primary-hover); }
.shorten-form button:active { transform: scale(.97); }

/* ===== Success Banner ===== */
.success-banner {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    animation: slideDown .3s ease;
}

@media (prefers-color-scheme: dark) {
    .success-banner {
        background: #052e16;
        border-color: #166534;
    }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.success-icon { font-size: 1.25rem; flex-shrink: 0; }

.success-body {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
}

.short-url {
    font-weight: 700;
    font-size: 1.05rem;
    color: #16a34a;
    word-break: break-all;
}

@media (prefers-color-scheme: dark) {
    .short-url { color: #4ade80; }
}

.long-url-label {
    color: var(--text-muted);
    font-size: .85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.banner-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: .25rem;
    line-height: 1;
}
.banner-close:hover { color: var(--text); }

/* ===== Error Banner ===== */
.error-banner {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    animation: slideDown .3s ease;
}

@media (prefers-color-scheme: dark) {
    .error-banner {
        background: #450a0a;
        border-color: #991b1b;
    }
}

.error-icon { font-size: 1.25rem; flex-shrink: 0; }

.error-body {
    flex: 1;
    font-size: .9rem;
    color: var(--text);
}

/* ===== Content Grid ===== */
.content-grid {
    margin-top:1em;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
}

@media (max-width: 1200px) {
    .content-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .content-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .content-grid { grid-template-columns: 1fr; }
}

.flex-row {
    display: grid;
    gap: .75rem;
    align-items: flex-start;
    grid-template-columns: repeat(3, 1fr);
}

.flex-row > * {
    flex: 1;
    min-width: 320px;
}

@media (max-width: 700px) {
    .flex-row { flex-direction: column; }
}

/* ===== Weather ===== */
.weather-card {
    padding: .65rem .75rem;
    display: block;
    align-items: center;
}

.weather-card h2 {
    font-size: .85rem;
    margin-bottom: 0;
}

.weather-compact-body {
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.weather-compact-current {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.weather-compact-current .weather-icon-big {
    font-size: 1.35rem;
}

.weather-compact-current .weather-temp {
    font-size: 1.1rem;
}

.weather-compact-current .weather-desc {
    font-size: .78rem;
}

.weather-stats {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.weather-feels {
    font-size: .75rem;
    color: var(--text-muted);
}

.weather-compact .forecast {
    border-top: none;
    padding-top: 0;
    gap: .25rem;
}

.weather-compact .forecast-day {
    min-width: 38px;
}

.weather-compact .forecast-name {
    font-size: .6rem;
}

.weather-compact .forecast-icon {
    font-size: .85rem;
}

.weather-compact .forecast-hi {
    font-size: .72rem;
}

.weather-compact .forecast-lo {
    font-size: .65rem;
}

/* ===== Forecast ===== */
.forecast {
    display: flex;
    gap: .5rem;
    justify-content: space-between;
}

.forecast-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
    min-width: 56px;
}

.forecast-name {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.forecast-icon { font-size: 1.3rem; }

.forecast-hi {
    font-size: .9rem;
    font-weight: 600;
}

.forecast-lo {
    font-size: .8rem;
    color: var(--text-muted);
}

/* ===== News ===== */
.news-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.news-item {
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}
.news-item:last-child { border-bottom: none; padding-bottom: 0; }

.news-link {
    display: block;
    font-size: .95rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text);
}
.news-link:hover { color: var(--primary); }

.news-meta {
    display: block;
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

.empty-state {
    color: var(--text-muted);
    font-size: .9rem;
    text-align: center;
    padding: 2rem 0;
}

/* ===== Ad Container ===== */
.ad-container {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ad-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: .5rem;
    align-self: flex-start;
}

/* ===== About Section ===== */
.about-card {
    line-height: 1.7;
}

.about-card h2 {
    font-size: 1.3rem;
    margin-bottom: .75rem;
}

.about-card h3 {
    font-size: 1.05rem;
    margin: 1.25rem 0 .5rem;
    font-weight: 600;
}

.about-card p {
    margin-bottom: .75rem;
    color: var(--text);
    font-size: .95rem;
}

.about-card ul {
    margin: .5rem 0 1rem 1.25rem;
    list-style: disc;
}

.about-card li {
    margin-bottom: .5rem;
    font-size: .95rem;
    line-height: 1.5;
    color: var(--text);
}

.about-card code {
    background: var(--primary-light);
    padding: .15rem .4rem;
    border-radius: 4px;
    font-size: .9em;
}

.about-cta {
    font-weight: 600;
    color: var(--primary);
    font-size: 1rem;
    margin-top: .5rem;
}

/* ===== Header Navigation ===== */
.header-nav {
    display: flex;
    gap: .25rem;
    align-items: center;
    margin: 0 auto;
}
.header-nav a {
    font-size: .82rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: .3rem .4rem;
    border-radius: 6px;
    transition: color .2s, background .2s;
}
.header-nav a:hover {
    color: var(--primary);
    background: var(--primary-light);
    text-decoration: none;
}

@media (max-width: 700px) {
    .header-nav { display: none; }
}

/* ===== Section Intro & Divider ===== */
.section-intro {
    color: var(--text-muted);
    font-size: .95rem;
    margin-bottom: 1.25rem;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ===== How-To Section ===== */

.how-to-steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.how-to-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: .9rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-body {
    flex: 1;
    font-size: .95rem;
    line-height: 1.5;
}

.step-body strong {
    color: var(--text);
}

.step-outro {
    margin-top: 1rem;
    font-size: .9rem;
    color: var(--text-muted);
}

/* ===== Tips Section ===== */

.tips-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 700px) {
    .tips-grid { grid-template-columns: 1fr; }
}

.tip-card {
    padding: 1.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: box-shadow .2s, transform .2s;
}

.tip-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.tip-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: .5rem;
}

.tip-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .35rem;
}

.tip-card p {
    font-size: .88rem;
    color: var(--text-muted);
    line-height: 1.55;
}

/* ===== FAQ Section ===== */

.faq-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.faq-item:last-child { border-bottom: none; }

.faq-question {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: .35rem;
    color: var(--text);
}

.faq-answer {
    font-size: .9rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* ===== Footer ===== */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    background: var(--card-bg);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: .85rem;
    color: var(--text-muted);
}

.footer-nav {
    display: flex;
    gap: 1rem;
}

.footer-nav a {
    color: var(--text-muted);
    font-size: .85rem;
}
.footer-nav a:hover { color: var(--primary); }

/* ===== Responsive ===== */
@media (max-width: 700px) {
    .weather-card { width: 100%; }
    .weather-compact-body { flex-wrap: wrap; }
    .how-to-step { flex-direction: column; align-items: stretch; }
    .step-num { align-self: flex-start; }
}

@media (max-width: 600px) {
    .header-inner { flex-direction: column; gap: .25rem; }
    .hero-card { padding: 1.5rem 1rem; }
    .hero-card h1 { font-size: 1.35rem; }
    .shorten-form { flex-direction: column; }
    .shorten-form button { width: 100%; }
    .weather-card { flex-wrap: wrap; }
    .weather-compact-current { justify-content: center; }
    .weather-compact .forecast { justify-content: center; }
    .footer-inner { flex-direction: column; text-align: center; }
    .forecast { overflow-x: auto; gap: .25rem; }
}
