/* ============================================================
   VLE PC — components: header, buttons, cards, forms, footer
   ============================================================ */

/* ── Header ──────────────────────────────────────────────── */

.header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--gray-200);
}

.header__inner {
    max-width: var(--container-max);
    margin-inline: auto;
    padding: 0 var(--space-6);
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header__hamburger {
    display: none;
    color: var(--text-primary);
    padding: var(--space-2);
    margin-left: calc(var(--space-2) * -1);
    border-radius: var(--radius-md);
}

.header__logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    font-weight: 700;
    font-size: var(--text-xl);
    color: var(--text-primary);
    letter-spacing: -.02em;
}

.header__logo:hover { color: var(--text-primary); }

.header__logo-mark {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: var(--gradient-button);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: 0;
}

.header__logo-text em { font-style: normal; color: var(--primary-600); }

/* An uploaded logo is sized by height; the width follows the picture, and is
   capped so a very wide logo cannot squeeze the rest of the header off screen. */
.header__logo-img {
    width: auto;
    max-width: 210px;
    object-fit: contain;
    display: block;
}

@media (max-width: 560px) {
    .header__logo-img { max-width: 140px; }
}

.header__nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-left: var(--space-2);
}

.header__nav-close { display: none; }

.category-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.category-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.category-btn.active {
    background: var(--primary-50);
    color: var(--primary-700);
}

.header__search {
    position: relative;
    flex: 1;
    max-width: 320px;
    margin-left: auto;
}

.header__search-input {
    width: 100%;
    padding: var(--space-2) var(--space-8) var(--space-2) var(--space-8);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    background: var(--gray-50);
    font-size: var(--text-sm);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.header__search-input:focus {
    outline: none;
    border-color: var(--primary-400);
    background: var(--bg-secondary);
}

.header__search-icon,
.header__search-clear {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    line-height: 0;
}

.header__search-icon { left: var(--space-3); pointer-events: none; }
.header__search-clear { right: var(--space-3); }

.header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.header__nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: var(--z-modal-backdrop);
}

.header__nav-backdrop.open { display: block; }

/* Coin pill in the header for signed-in users. */
.coin-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--warning-light);
    color: #92400e;
    font-size: var(--text-sm);
    font-weight: 600;
}

.coin-pill:hover { color: #92400e; }

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast),
                background var(--transition-fast), border-color var(--transition-fast);
}

.btn:disabled,
.btn[aria-disabled='true'] {
    opacity: .55;
    cursor: not-allowed;
    transform: none !important;
}

.btn--primary {
    background: var(--gradient-button);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn--primary:hover:not(:disabled) {
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn--secondary {
    background: var(--bg-secondary);
    border-color: var(--gray-200);
    color: var(--text-primary);
}

.btn--secondary:hover:not(:disabled) {
    border-color: var(--primary-300);
    background: var(--primary-50);
    color: var(--primary-700);
}

.btn--ghost { color: var(--text-secondary); }
.btn--ghost:hover:not(:disabled) { background: var(--gray-100); color: var(--text-primary); }

.btn--danger { background: var(--error); color: #fff; }

.btn--sm { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.btn--lg { padding: var(--space-4) var(--space-6); font-size: var(--text-base); }
.btn--block { width: 100%; }

/* ── Cards & grids ───────────────────────────────────────── */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-6);
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-4);
}

.tool-card {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: inherit;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast),
                border-color var(--transition-fast);
}

.tool-card:hover {
    color: inherit;
    transform: translateY(-2px);
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
}

.tool-card__icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: var(--primary-50);
    display: grid;
    place-items: center;
    object-fit: contain;
    padding: 6px;
}

/* A tool that ships its own artwork fills the tile edge to edge, no violet wash. */
.tool-card__icon--img {
    padding: 0;
    background: none;
    overflow: hidden;
}

.tool-card__icon--img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tool-card__name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.tool-card__desc {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: var(--leading-normal);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-card__cost {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: var(--space-2);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    background: var(--warning-light);
    color: #92400e;
    font-size: var(--text-xs);
    font-weight: 600;
}

/* ── Big-icon tiles — the artwork fills the tile, tool name small underneath.
   The icon is what people read before clicking, so it gets the space; the
   one-line description is dropped. ── */
.tool-grid--tiles {
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
    gap: var(--space-4);
}

.tool-grid--tiles .tool-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 0;
    padding: 0;
    overflow: hidden; /* the icon is flush with the card edges, so it needs the
                         card's own rounded corners clipped onto it, not its own */
}

/* Full-size icon: no violet frame, no padding, no size cap — it fills the
   tile completely, edge to edge, instead of floating in the middle of a
   mostly-blank card. A custom-uploaded icon is designed as a whole card in
   itself (its own background, border, even its own name label sometimes);
   this is what lets it actually look like one instead of a small picture
   inside another, redundant white card. */
.tool-grid--tiles .tool-card__icon {
    width: 100%;
    max-width: none;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 0;
    background: none;
    padding: 0;
}

.tool-grid--tiles .tool-card__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tool-grid--tiles .tool-card__icon svg {
    width: 88px;
    height: 88px;
}

/* Colour-emoji icon: a big glyph on a soft tinted tile, one per tool. */
.tool-card__emoji { font-size: 24px; line-height: 1; }

.tool-grid--tiles .tool-card__icon--emoji {
    background: var(--primary-50);
}

.tool-grid--tiles .tool-card__icon--emoji .tool-card__emoji {
    font-size: 88px;
}

@media (max-width: 520px) {
    .tool-grid--tiles .tool-card__icon--emoji .tool-card__emoji { font-size: 64px; }
}

/* Matched line icon (per-tool, real artwork via tool_icon_symbol() — not
   the category glyph, not an emoji): the same tinted-square treatment as
   the emoji tiles, sized generously since this is what people scan the
   whole grid by before they ever read a name. */
.tool-grid--tiles .tool-card__icon--symbol {
    background: var(--primary-50);
}

.tool-grid--tiles .tool-card__icon--symbol svg {
    width: 96px;
    height: 96px;
    color: var(--primary-600);
}

@media (max-width: 520px) {
    .tool-grid--tiles .tool-card__icon--symbol svg { width: 70px; height: 70px; }
}

/* No text row at all — the tile is the icon, full stop. The square icon
   itself (with its own name baked in where an admin designed it that way,
   as with the custom-uploaded ones) is what carries the tool's identity now. */
.tool-grid--tiles .tool-card__icon + span { display: none; }

.tool-grid--tiles .tool-card__desc { display: none; }

/* The coin cost is shown on the tool's own page before anything runs — the
   tile itself stays a clean icon-plus-name so nothing else competes with it. */
.tool-grid--tiles .tool-card__cost { display: none; }

@media (max-width: 520px) {
    .tool-grid--tiles { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* Horizontally scrolling "Popular" strip. */
.popular-rail {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    padding-bottom: var(--space-3);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.popular-card {
    flex-shrink: 0;
    min-width: 190px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: inherit;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast),
                border-color var(--transition-fast);
}

.popular-card:hover {
    color: inherit;
    transform: translateY(-2px);
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
}

.popular-card__name { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.popular-card__cat { font-size: var(--text-xs); color: var(--text-tertiary); text-transform: capitalize; }

/* The same rail, used for the poster strip on the homepage. A poster card is a
   picture with a caption, not an icon with a label, so it needs its own layout
   rather than the tool card's row of icon + name + category — this variant
   sits alongside .popular-card rather than changing it, so the tools rail
   above it on the homepage is untouched. */
.popular-card--poster {
    flex-direction: column;
    align-items: stretch;
    width: 150px;
    min-width: 150px;
    padding: 0;
    overflow: hidden;
}

.popular-card--poster img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: top;
    background: var(--gray-100);
}

.popular-card--poster .popular-card__name {
    /* Shortened in PHP by short_title() — see the comment on .poster-card__title
       in content.css for why that replaced a CSS line-clamp here. The height
       adds the padding back in for the same border-box reason noted there. */
    display: block;
    overflow: hidden;
    padding: var(--space-2);
    white-space: normal;
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1.4;
    height: calc(1.4em * 2 + var(--space-2) * 2);
}

.section-heading {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.section-heading h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin: 0;
}

.section-heading__count {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    background: var(--gray-100);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
}

/* ── Forms ───────────────────────────────────────────────── */

.field { margin-bottom: var(--space-4); }

.field__label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.field__hint {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.input,
.select,
.textarea {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    font-size: var(--text-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.textarea { min-height: 120px; resize: vertical; }

/* ── Alerts ──────────────────────────────────────────────── */

.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
    border: 1px solid transparent;
}

.alert--info    { background: var(--info-light);    color: #1e40af; border-color: #bfdbfe; }
.alert--success { background: var(--success-light); color: #065f46; border-color: #a7f3d0; }
.alert--warning { background: var(--warning-light); color: #92400e; border-color: #fde68a; }
.alert--error   { background: var(--error-light);   color: #991b1b; border-color: #fecaca; }

/* ── Drop zone (shared by every file tool) ───────────────── */

.dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
    padding: var(--space-12) var(--space-6);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary-400);
    background: var(--primary-50);
}

.dropzone__icon { margin: 0 auto var(--space-4); color: var(--primary-500); }
.dropzone__title { font-weight: 600; margin-bottom: var(--space-1); }
.dropzone__hint { font-size: var(--text-sm); color: var(--text-tertiary); }

/* ── FAQ ─────────────────────────────────────────────────── */

.faq-item {
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-4) 0;
}

.faq-item summary {
    cursor: pointer;
    font-weight: 600;
    font-size: var(--text-base);
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
}

.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--primary-600); font-size: var(--text-xl); line-height: 1; }
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p { margin: var(--space-3) 0 0; font-size: var(--text-sm); }

/* ── Announcements ───────────────────────────────────────── */

.announce-bar { background: var(--info-light); color: #1e40af; font-size: var(--text-sm); }
.announce-bar--success { background: var(--success-light); color: #065f46; }
.announce-bar--warning { background: var(--warning-light); color: #92400e; }
.announce-bar--error   { background: var(--error-light);   color: #991b1b; }

.announce-bar__inner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-block: var(--space-3);
}

.announce-bar__link { color: inherit; text-decoration: underline; font-weight: 600; white-space: nowrap; }
.announce-bar__close {
    margin-left: auto;
    color: inherit;
    opacity: .6;
    font-size: 22px;
    line-height: 1;
    padding: 0 var(--space-2);
}
.announce-bar__close:hover { opacity: 1; }

.announce-toast {
    position: fixed;
    left: 50%;
    bottom: var(--space-6);
    transform: translateX(-50%);
    z-index: var(--z-toast);
    width: min(440px, calc(100vw - var(--space-8)));
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--info);
    box-shadow: var(--shadow-xl);
    animation: toast-in 250ms ease;
}

.announce-toast--success { border-left-color: var(--success); }
.announce-toast--warning { border-left-color: var(--warning); }
.announce-toast--error   { border-left-color: var(--error); }

.announce-toast strong { display: block; font-size: var(--text-sm); }
.announce-toast p { margin: var(--space-1) 0 0; font-size: var(--text-sm); }
.announce-toast a { font-size: var(--text-sm); font-weight: 600; }
.announce-toast__close { color: var(--text-tertiary); font-size: 20px; line-height: 1; align-self: flex-start; }

/* Floating "Join WhatsApp Channel" — every page (loaded from footer.php),
   fixed bottom-right, an animated pulse ring so it draws the eye without a
   sound or a badge count. Real link comes from the admin-editable
   contact.whatsapp setting, same one the site's own footer link already
   uses — one source of truth, not a second hardcoded copy of the URL. */
.wa-float {
    position: fixed;
    right: var(--space-5);
    bottom: var(--space-5);
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #fff;
    padding: 12px 20px 12px 12px;
    border-radius: 999px;
    box-shadow: 0 10px 30px -8px rgba(18, 140, 126, .55);
    text-decoration: none;
    font-weight: 700;
    font-size: var(--text-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.wa-float:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 14px 36px -6px rgba(18, 140, 126, .65); }
.wa-float__icon-wrap {
    position: relative;
    width: 32px; height: 32px;
    flex-shrink: 0;
    display: grid; place-items: center;
}
.wa-float__icon-wrap svg { width: 20px; height: 20px; position: relative; z-index: 1; }
.wa-float__ring {
    position: absolute; inset: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .4);
    animation: wa-float-pulse 2.2s ease-out infinite;
}
@keyframes wa-float-pulse {
    0%   { transform: scale(.6); opacity: .8; }
    70%  { transform: scale(2); opacity: 0; }
    100% { transform: scale(2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .wa-float__ring { animation: none; display: none; }
}
@media (max-width: 520px) {
    .wa-float { padding: 12px; }
    .wa-float__label { display: none; }
}

.announce-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(15, 23, 42, .5);
    display: grid;
    place-items: center;
    padding: var(--space-4);
}

.announce-modal__box {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-8);
    width: min(460px, 100%);
    border-top: 5px solid var(--info);
}

.announce-modal__box--success { border-top-color: var(--success); }
.announce-modal__box--warning { border-top-color: var(--warning); }
.announce-modal__box--error   { border-top-color: var(--error); }

.announce-modal__box h2 { font-size: var(--text-xl); margin-bottom: var(--space-3); }
.announce-modal__actions { display: flex; gap: var(--space-2); margin-top: var(--space-6); flex-wrap: wrap; }

/* ── Ad slots ────────────────────────────────────────────── */

/* Reserve the height so an ad loading late does not shove the page down —
   layout shift is both irritating and a ranking signal. */
.ad-slot { min-height: 100px; display: grid; place-items: center; overflow: hidden; }
.ad-slot--top { margin-top: var(--space-4); }
.ad-slot--bottom { margin-block: var(--space-8) var(--space-4); }
.ad-slot:empty { display: none; }

/* ── Footer ──────────────────────────────────────────────── */

.footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: var(--space-12) 0 var(--space-6);
    margin-top: var(--space-16);
}

.footer a { color: var(--gray-300); font-size: var(--text-sm); }
.footer a:hover { color: #fff; }

.footer__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-8);
}

.footer__title {
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: var(--space-4);
}

.footer__list { list-style: none; padding: 0; }
.footer__list li { margin-bottom: var(--space-2); }

.footer__bottom {
    margin-top: var(--space-10);
    padding-top: var(--space-6);
    border-top: 1px solid var(--gray-700);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--gray-400);
}

.footer__pay {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--gray-400);
}
