/* ================================================================
   Rank Tracker Theme — main.css
   Design tokens + global layout + header + footer + components
   ================================================================ */

/* ---- Design tokens ---- */
:root {
    --color-primary:     #2563EB;
    --color-primary-h:   #1D4ED8;
    --color-primary-10:  #EFF6FF;
    --color-primary-20:  #DBEAFE;

    --color-green:       #16A34A;
    --color-green-bg:    #DCFCE7;
    --color-blue:        #2563EB;
    --color-blue-bg:     #DBEAFE;
    --color-yellow:      #CA8A04;
    --color-yellow-bg:   #FEF9C3;
    --color-red:         #DC2626;
    --color-red-bg:      #FEE2E2;

    --text-base:         #0F172A;
    --text-muted:        #64748B;
    --text-subtle:       #94A3B8;

    --border:            #E2E8F0;
    --border-strong:     #CBD5E1;
    --bg-page:           #F8FAFC;
    --bg-card:           #FFFFFF;
    --bg-sidebar:        #0F172A;
    --bg-sidebar-hover:  #1E293B;
    --bg-topbar:         #FFFFFF;

    --radius-sm:         4px;
    --radius-md:         8px;
    --radius-lg:         12px;
    --shadow-sm:         0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:         0 4px 16px rgba(0,0,0,.08);

    --font:              'Inter', system-ui, -apple-system, sans-serif;
    --header-h:          60px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-base);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

/* ---- Container ---- */
.container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 24px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn--primary:hover { background: var(--color-primary-h); border-color: var(--color-primary-h); }

.btn--ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--bg-page); color: var(--text-base); }

.btn--sm  { padding: 6px 14px; font-size: 13px; }
.btn--lg  { padding: 12px 24px; font-size: 15px; }

/* ---- Form inputs ---- */
.input-text,
.input-select {
    height: 36px;
    padding: 0 12px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-base);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.input-text:focus,
.input-select:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.input-select--sm { height: 30px; font-size: 12px; padding: 0 8px; }

/* ================================================================
   SITE HEADER
   ================================================================ */
.site-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.site-header > .container { height: 100%; }

.site-header__inner {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 24px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.site-logo__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-base);
}
.site-logo:hover .site-logo__name { color: var(--color-primary); }

.site-nav { flex: 1; }
.site-nav__list { display: flex; gap: 4px; }
.site-nav__list li a {
    display: block;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.site-nav__list li a:hover,
.site-nav__list li.current-menu-item a { background: var(--primary-10); color: var(--color-primary); }

.site-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.header-user {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}
.nav-toggle__bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-base);
    border-radius: 2px;
    transition: transform .2s;
}

/* ================================================================
   SITE MAIN & FOOTER
   ================================================================ */
.site-main { flex: 1; }

.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: 20px 0;
}
.site-footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-subtle);
}
.site-footer__powered a { color: var(--text-subtle); }
.site-footer__powered a:hover { color: var(--color-primary); }

/* ================================================================
   PAGE CONTENT
   ================================================================ */
.page-content { padding: 48px 0; }
.page-title { font-size: 28px; font-weight: 700; margin-bottom: 24px; }
.entry-content { max-width: 760px; }

/* ================================================================
   HOMEPAGE — HERO
   ================================================================ */
.hero {
    padding: 80px 0 64px;
    background: linear-gradient(135deg, var(--color-primary-10) 0%, #fff 60%);
}
.hero__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
}
.hero__badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--color-primary-20);
    color: var(--color-primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.hero__title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 20px;
    color: var(--text-base);
}
.hero__desc {
    font-size: 16px;
    color: var(--text-muted);
    max-width: 440px;
    margin-bottom: 32px;
    line-height: 1.7;
}

/* Preview card */
.preview-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 20px 24px;
    border: 1px solid var(--border);
}
.preview-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.preview-card__title { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.preview-card__badge {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}
.preview-card__badge--green { background: var(--color-green-bg); color: var(--color-green); }
.preview-card__stats {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.preview-stat__val {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-base);
}
.preview-stat__lbl { font-size: 12px; color: var(--text-subtle); }

/* ================================================================
   HOMEPAGE — FEATURES
   ================================================================ */
.features { padding: 64px 0 80px; }
.features__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s, border-color .2s;
}
.feature-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-primary-20); }
.feature-card__icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-10);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.feature-card p  { font-size: 14px; color: var(--text-muted); line-height: 1.65; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
    .hero__inner       { grid-template-columns: 1fr; }
    .hero__preview     { display: none; }
    .features__grid    { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .site-nav          { display: none; }
    .site-nav.is-open  { display: block; position: absolute; top: var(--header-h); left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border); padding: 12px 0; z-index: 100; }
    .site-nav.is-open .site-nav__list { flex-direction: column; padding: 0 16px; }
    .nav-toggle        { display: flex; }
    .site-header__actions .header-user { display: none; }
    .features__grid    { grid-template-columns: 1fr; }
}
