/* Cheff Downloader - core styles */

:root {
    --brand-1: #833ab4;
    --brand-2: #fd1d1d;
    --brand-3: #fcb045;
    --brand-gradient: linear-gradient(90deg, var(--brand-1) 0%, var(--brand-2) 55%, var(--brand-3) 100%);
    --bg: #0f0f14;
    --bg-soft: #16161f;
    --surface: #1c1c28;
    --surface-2: #23232f;
    --border: #2c2c3a;
    --text: #f2f2f7;
    --text-muted: #9a9aab;
    --success: #22c55e;
    --danger: #ef4444;
    --radius: 14px;
    --radius-sm: 8px;
    --max-width: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(28px, 4vw, 44px); }
h2 { font-size: clamp(22px, 3vw, 32px); }
h3 { font-size: 20px; }
p { color: var(--text-muted); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 26px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--brand-gradient); color: #fff; }
.btn--secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 15, 20, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.brand--footer { font-size: 18px; margin-bottom: 10px; }
.site-nav { display: flex; gap: 22px; }
.site-nav a { color: var(--text-muted); font-weight: 500; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a.active { color: var(--text); border-color: var(--brand-2); }
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 24px; cursor: pointer; }

/* Language switcher */
.lang-switcher { position: relative; margin-left: 6px; }
.lang-switcher__toggle {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 14px;
    cursor: pointer;
}
.lang-switcher__toggle:hover { border-color: var(--brand-2); }
.lang-switcher__menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    min-width: 180px;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,.4);
    z-index: 60;
}
.lang-switcher__menu.open { display: block; }
.lang-switcher__menu a {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-muted);
}
.lang-switcher__menu a:hover { background: var(--surface-2); color: var(--text); }
.lang-switcher__menu a.active { color: var(--text); font-weight: 700; }
[dir="rtl"] .lang-switcher__menu { right: auto; left: 0; }

@media (max-width: 800px) {
    .nav-toggle { display: block; }
    .site-nav {
        position: absolute;
        top: 64px; left: 0; right: 0;
        background: var(--bg-soft);
        flex-direction: column;
        padding: 12px 20px 20px;
        gap: 14px;
        border-bottom: 1px solid var(--border);
        display: none;
    }
    .site-nav.open { display: flex; }
}

/* Hero */
.hero {
    padding: 64px 0 40px;
    text-align: center;
    background: radial-gradient(ellipse at top, rgba(131,58,180,0.25), transparent 60%);
}
.hero .badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 18px;
}
.hero p.lead { max-width: 640px; margin: 0 auto 8px; font-size: 18px; }

/* Downloader widget */
.downloader { padding: 20px 0 50px; }
.downloader-form { max-width: 760px; margin: 0 auto; }
.downloader-form__row {
    display: flex;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
}
.downloader-form__input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 16px;
    padding: 12px 14px;
}
.downloader-form__input::placeholder { color: var(--text-muted); }
.downloader-form__submit { white-space: nowrap; min-width: 140px; }
.downloader-form__hint { text-align: center; font-size: 13px; margin-top: 12px; }

.btn-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.downloader-error {
    max-width: 760px;
    margin: 18px auto 0;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.4);
    color: #fca5a5;
    text-align: center;
}

.downloader-result {
    max-width: 760px;
    margin: 28px auto 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.downloader-result__preview { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.downloader-result__preview img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.result-username { font-weight: 700; margin: 0 0 6px; }
.result-caption { font-size: 14px; margin: 0; max-height: 4.8em; overflow: hidden; }
.downloader-result__buttons { display: flex; flex-wrap: wrap; gap: 10px; }

.downloader-ad { margin: 20px auto; max-width: 760px; text-align: center; }

/* Sections */
.section { padding: 50px 0; border-top: 1px solid var(--border); }
.section--tight { padding: 34px 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 28px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature-card .icon { font-size: 28px; margin-bottom: 10px; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 28px; counter-reset: step; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; position: relative; }
.step::before {
    counter-increment: step;
    content: counter(step);
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--brand-gradient); color: #fff; font-weight: 700;
    margin-bottom: 12px;
}

.faq { max-width: 800px; margin: 28px auto 0; }
.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--text-muted); font-size: 20px; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin-top: 10px; }

.related-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.related-links a { background: var(--surface-2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 999px; font-size: 14px; }
.related-links a:hover { border-color: var(--brand-2); }

/* Blog */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; margin-top: 28px; }
.blog-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.blog-card h3 { margin-bottom: 8px; }
.blog-card a.read-more { color: var(--brand-3); font-weight: 600; }
article.post { max-width: 760px; margin: 0 auto; }
article.post h2 { margin-top: 1.4em; }
article.post p, article.post li { color: #d3d3de; }

/* Static/legal pages */
.prose { max-width: 800px; margin: 0 auto; color: #d3d3de; }
.prose h2 { margin-top: 1.6em; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); padding: 40px 0 0; margin-top: 30px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; padding-bottom: 30px; }
.footer-col h4 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 12px; }
.footer-col a { display: block; color: var(--text-muted); padding: 4px 0; font-size: 14px; }
.footer-col a:hover { color: var(--text); }
.footer-bottom { border-top: 1px solid var(--border); padding: 16px 0; font-size: 13px; color: var(--text-muted); }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* Ad slots */
.ad-slot { display: flex; align-items: center; justify-content: center; overflow: hidden; margin: 16px auto; }
.ad-slot--sidebar { max-width: 300px; }

/* Interstitial modal */
.interstitial-modal {
    position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,.85);
    display: flex; align-items: center; justify-content: center;
}
.interstitial-modal[hidden] { display: none; }
.interstitial-modal__box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 92vw;
    text-align: center;
    border: 1px solid var(--border);
}
.interstitial-modal__note { margin-top: 14px; font-size: 14px; }

/* Admin */
.admin-body { background: var(--bg); color: var(--text); font-family: -apple-system, sans-serif; }
.admin-wrap { max-width: 900px; margin: 40px auto; padding: 0 20px; }
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; margin-bottom: 24px; }
.admin-card h2 { margin-top: 0; }
.form-field { margin-bottom: 18px; }
.form-field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.form-field input[type="text"], .form-field input[type="password"], .form-field textarea, .form-field select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.form-field textarea { min-height: 110px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.form-field .help { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-actions { display: flex; gap: 10px; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 14px; }
.alert--success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.4); color: #86efac; }
.alert--error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.4); color: #fca5a5; }
.admin-login-box { max-width: 380px; margin: 90px auto; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.admin-topbar a { color: var(--text-muted); font-size: 14px; }

/* RTL (Arabic, etc.) adjustments */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .site-header__inner { flex-direction: row-reverse; }
[dir="rtl"] .site-nav { flex-direction: row-reverse; }
[dir="rtl"] .downloader-result__preview { flex-direction: row-reverse; }
[dir="rtl"] .step::before, [dir="rtl"] .faq-item summary::after { margin-left: 0; }
[dir="rtl"] .footer-grid { text-align: right; }
[dir="rtl"] .brand { flex-direction: row-reverse; }
