/* ==========================================================
   SQLISM — RESOURCES PAGE
   IMPORTANT: resources.php never loads styles.css — its CSS
   variables (--bg-primary, --bg-card, --text-primary, --border, etc.)
   come from includes/navbar.css and breadcrumb.css instead (navbar.css
   wins for shared names since it's injected inside <body>, after
   breadcrumb.css in <head>). .hero/.container are NOT shared globally
   either — each content page (interview.css, tools/styles.css, etc.)
   defines its own copy, so resources.css has to as well. This block
   matches interview.css's "Studio v2" hero 1:1 (base fallback +
   body[data-page] override) so /resources looks consistent with
   /interview, /challenge, /quiz.
   Mobile-first; dark theme via [data-theme="dark"] overrides below.
   ========================================================== */

/* ---------------- BASE BODY ----------------
   Every other content page (interview.css, tools/styles.css, etc.) sets
   this directly on body. resources.css was missing it, so the page
   background stayed white in dark mode even though the hero/cards/search
   were already dark-styled — the single biggest dark-mode mismatch on
   this page. --bg-primary/--text-primary are theme-aware CSS variables
   (from navbar.css), so this alone makes the whole page track the theme. */
body {
    background: var(--bg-primary, #ffffff);
    color: var(--text-primary, #1f2937);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ---------------- HERO (base fallback) ---------------- */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(16, 185, 129, 0.1));
    border-bottom: 2px solid var(--border);
}
.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* ---------------- HERO (Studio v2 override) ----------------
   Scoped by data-page, same as every other content page, so it
   wins over the base rules above. */
body[data-page="resources"] .hero {
    position: relative;
    margin: clamp(16px, 3vw, 30px) clamp(12px, 4vw, 48px);
    padding: clamp(38px, 6vw, 68px) clamp(22px, 4vw, 48px);
    border-radius: 24px;
    text-align: center;
    color: #fff;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(120% 130% at 10% -10%, rgba(124, 92, 255, 0.40), transparent 60%),
        radial-gradient(90% 120% at 100% 112%, rgba(34, 211, 238, 0.22), transparent 58%),
        linear-gradient(158deg, #0c1024 0%, #0a0d1a 55%, #090b16 100%);
    box-shadow: 0 40px 90px -42px rgba(10, 13, 26, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
body[data-page="resources"] .hero::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 1;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
                       linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 42%, transparent 82%);
    mask-image: radial-gradient(120% 90% at 50% 0%, #000 42%, transparent 82%);
}
body[data-page="resources"] .hero-content {
    position: relative;
    z-index: 1;
    max-width: 920px;
    margin: 0 auto;
}
body[data-page="resources"] .hero h1 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(2.1rem, 5vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.07;
    color: #fff;
    -webkit-text-fill-color: #fff;
    background: none;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    text-align: center;
    animation: none;
}
body[data-page="resources"] .hero h1 i {
    background: linear-gradient(120deg, #a3e635, #22d3ee 55%, #7c5cff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transform: translateX(-4px);
    padding-right: 4px;
}
body[data-page="resources"] .hero p {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: rgba(226, 232, 240, 0.82);
    -webkit-text-fill-color: rgba(226, 232, 240, 0.82);
    background: none;
    opacity: 1;
    font-size: clamp(1rem, 1.5vw, 1.22rem);
    line-height: 1.7;
    max-width: 680px;
    margin: 0 auto;
}
body[data-page="resources"] .hero-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}
body[data-page="resources"] .hero-stats .stat {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
body[data-page="resources"] .hero-stats .stat:hover {
    transform: translateY(-2px);
    border-color: rgba(124, 92, 255, 0.5);
    background: rgba(124, 92, 255, 0.14);
}
body[data-page="resources"] .hero-stats .stat i {
    color: #a3e635;
    font-size: 1rem;
}
body[data-page="resources"] .hero-stats .stat span {
    color: #e7eaf5;
    font-weight: 600;
    font-size: 0.92rem;
}

@media (max-width: 768px) {
    body[data-page="resources"] .hero h1 { gap: 10px; }
}

.res-controls,
.res-controls *,
.res-grid,
.res-grid *,
.res-cta,
.res-cta * { box-sizing: border-box; }

/* ---------------- SEARCH ---------------- */
.res-controls { margin: 2rem 0 1.5rem; }

.res-search {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 560px;
    margin: 0 auto 18px;
    background: var(--bg-card, #fff);
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: var(--radius-lg, 20px);
    box-shadow: 0 2px 10px -6px rgba(15, 23, 42, 0.15);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.res-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow, rgba(139, 92, 246, 0.25));
}
.res-search-icon {
    flex-shrink: 0;
    margin-left: 16px;
    color: var(--text-secondary);
    font-size: 15px;
}
.res-search input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    outline: none;
    padding: 13px 10px;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--text-primary);
}
.res-search input::placeholder { color: var(--text-secondary); opacity: .8; }
.res-search-clear {
    flex-shrink: 0;
    border: none;
    background: var(--bg-tertiary, #e2e8f0);
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    margin-right: 10px;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 11px;
}
.res-search-clear:hover { background: var(--primary); color: #fff; }

/* ---------------- FILTER CHIPS ---------------- */
.res-filter-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}
.res-filter-row--level { margin-bottom: 4px; }

.res-chip {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary, #f8fafc);
    border: none;
    border-radius: 999px;
    padding: 7px 15px;
    cursor: pointer;
    transition: transform .15s cubic-bezier(.34,1.4,.64,1), background .2s ease, color .2s ease;
}
.res-chip:hover { transform: translateY(-1px); color: var(--primary); }
.res-chip.is-active {
    background: linear-gradient(135deg, #a3e635, #22d3ee 55%, #7c5cff);
    color: #0a0d1a;
    box-shadow: 0 6px 16px -8px rgba(124, 92, 255, 0.5);
}
.res-chip--level { font-size: 12px; padding: 5px 13px; }

.res-meta {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 10px 0 0;
}

/* ---------------- RESOURCE GRID ---------------- */
.res-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin: 1.5rem 0 3rem;
}

.res-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 22px;
    border-radius: 18px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    box-shadow: 0 2px 12px -8px rgba(15, 23, 42, 0.18);
    transition: transform .2s cubic-bezier(.34,1.4,.64,1), box-shadow .25s ease, border-color .25s ease;
}
.res-card:hover {
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 18px 40px -20px rgba(139, 92, 246, 0.55);
}
.res-card[hidden] { display: none; }

.res-card--premium {
    background: linear-gradient(180deg, rgba(163, 230, 53, 0.07), var(--bg-card, #fff) 40%);
    border-color: rgba(163, 230, 53, 0.4);
}

.res-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.res-card__icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 16px;
    color: #fff;
    background: linear-gradient(135deg, #a3e635, #22d3ee 55%, #7c5cff);
    box-shadow: 0 8px 18px -8px rgba(124, 92, 255, 0.55);
}
.res-card--premium .res-card__icon { background: linear-gradient(135deg, #a3e635, #10b981); }

.res-card__level {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: 999px;
    text-transform: capitalize;
}
.res-card__level--beginner     { color: #047857; background: rgba(16, 185, 129, 0.14); }
.res-card__level--intermediate { color: #2563eb; background: rgba(59, 130, 246, 0.14); }
.res-card__level--advanced     { color: #b45309; background: rgba(245, 158, 11, 0.16); }

.res-card__title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--text-primary);
    margin: 0;
}
.res-card__desc {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-secondary);
    font-weight: 400;
    margin: 0;
    flex: 1;
}

.res-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border, #e2e8f0);
}
.res-card__file {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.res-card__file i { color: #ef4444; margin-right: 3px; }

.res-card__btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 700;
    color: #fff;
    background: #111827;
    padding: 9px 15px;
    border-radius: 10px;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
    white-space: nowrap;
}
.res-card__btn:hover {
    background: #000;
    box-shadow: 0 10px 22px -8px rgba(0, 0, 0, 0.5);
    transform: translateY(-1px);
}
.res-card__btn--locked {
    background: linear-gradient(135deg, #a3e635, #65a30d);
    color: #10210a;
}
.res-card__btn--locked:hover {
    background: linear-gradient(135deg, #bef264, #84cc16);
    box-shadow: 0 10px 22px -8px rgba(163, 230, 53, 0.6);
}

/* Sqlism Pro unlock CTA — separate from --locked (the plain "sign in"
   case above stays lime) so the Pro-branded gold doesn't bleed onto
   an action that has nothing to do with Pro. Added 2026-08-23 as
   part of a sitewide Pro-branding gold pass. */
.res-card__btn--pro {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #422006;
}
.res-card__btn--pro:hover {
    background: linear-gradient(135deg, #fcd34d, #f59e0b);
    box-shadow: 0 10px 22px -8px rgba(217, 119, 6, 0.55);
}

[data-theme="dark"] .res-card__btn { background: #f9fafb; color: #111827; }
[data-theme="dark"] .res-card__btn:hover { background: #fff; box-shadow: 0 10px 22px -8px rgba(0, 0, 0, 0.7); }

.res-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14.5px;
    padding: 40px 0 60px;
}

/* ---------------- GUEST CTA BANNER ---------------- */
.res-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin: 0 0 3.5rem;
    padding: 26px 30px;
    border-radius: 20px;
    background: linear-gradient(120deg, #111827, #1e293b 55%, #14532d);
    box-shadow: 0 20px 44px -24px rgba(15, 23, 42, 0.6);
}
.res-cta__body h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 19px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 6px;
}
.res-cta__body h2 i { color: #a3e635; }
.res-cta__body p {
    font-size: 13.5px;
    line-height: 1.55;
    color: #cbd5e1;
    margin: 0;
    max-width: 560px;
}
.res-cta__btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #10210a;
    background: linear-gradient(135deg, #a3e635, #65a30d);
    padding: 13px 22px;
    border-radius: 12px;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}
.res-cta__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -12px rgba(163, 230, 53, 0.55);
}

/* ---------------- DARK THEME ---------------- */
[data-theme="dark"] .res-card { background: var(--bg-card, #1e293b); border-color: var(--border, #334155); }
[data-theme="dark"] .res-card--premium { background: linear-gradient(180deg, rgba(163, 230, 53, 0.1), var(--bg-card, #1e293b) 45%); border-color: rgba(163, 230, 53, 0.3); }
[data-theme="dark"] .res-card__level--beginner     { color: #6ee7b7; }
[data-theme="dark"] .res-card__level--intermediate { color: #93c5fd; }
[data-theme="dark"] .res-card__level--advanced     { color: #fcd34d; }
[data-theme="dark"] .res-search { background: var(--bg-card, #1e293b); border-color: var(--border, #334155); }
[data-theme="dark"] .res-chip:not(.is-active) { background: var(--bg-secondary, #1e293b); }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 640px) {
    .res-grid { grid-template-columns: 1fr; gap: 14px; }
    .res-filter-row { gap: 6px; }
    .res-chip { font-size: 12.5px; padding: 6px 12px; }
    .res-cta { flex-direction: column; align-items: stretch; text-align: center; padding: 24px 20px; }
    .res-cta__btn { justify-content: center; }
    .res-card__footer { flex-wrap: wrap; }
}

@media (max-width: 400px) {
    .res-card { padding: 18px; }
}
