/* ============================================================
 * design.css
 * Global design system – imported by all pages via header.php
 * Supports dark mode (default) and light mode via body.light-mode
 * ============================================================ */

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Dark mode (default) – Warm Neutral Dark ── */
:root {
    --bg:        #18140C;
    --bg2:       #211A10;
    --bg3:       #2C2318;
    --bg4:       #382D20;
    --border:    rgba(200,170,110,0.12);
    --border2:   rgba(200,170,110,0.24);
    --text:      #F5F0E8;
    --muted:     #A89070;
    --muted2:    #C8AE88;
    --accent:    #C87D30;
    --accent2:   #E8A855;
    --accent-bg: rgba(200,125,48,0.15);
    --green:     #4ade80;
    --green-bg:  rgba(74,222,128,0.10);
    --green-bd:  rgba(74,222,128,0.22);
    --red:       #f87171;
    --red-bg:    rgba(248,113,113,0.10);
    --red-bd:    rgba(248,113,113,0.18);
    --amber:     #E8A855;
    --amber-bg:  rgba(232,168,85,0.12);
    --amber-bd:  rgba(232,168,85,0.28);
    --premium:   #E8A855;
    --radius:    10px;
    --radius-lg: 14px;
    --font:      'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ── Dark mode contrast boosters ── */
:root .url-link,
:root .m-url-link      { color: #F5F0E8 !important; }
:root .desc-cell,
:root .m-short-desc    { color: #C8AE88; }
:root thead th         { color: #A89070; letter-spacing: 0.05em; }
:root .table-wrap      { border-color: rgba(200,170,110,0.14); }
:root tbody tr         { border-bottom-color: rgba(200,170,110,0.07); }

/* ── Light mode – Warm Neutral ── */
body.light-mode {
    --bg:        #FAFAF7;
    --bg2:       #FFFFFF;
    --bg3:       #F3F0E8;
    --bg4:       #EAE6D8;
    --border:    rgba(160,130,80,0.15);
    --border2:   rgba(160,130,80,0.30);
    --text:      #1C1A14;
    --muted:     #7A6A4A;
    --muted2:    #4A3E28;
    --accent:    #B86A00;
    --accent2:   #92400E;
    --accent-bg: rgba(184,106,0,0.08);
    --green:     #166534;
    --green-bg:  rgba(22,101,52,0.08);
    --green-bd:  rgba(22,101,52,0.20);
    --red:       #991B1B;
    --red-bg:    rgba(153,27,27,0.08);
    --red-bd:    rgba(153,27,27,0.18);
    --amber:     #92400E;
    --amber-bg:  rgba(146,64,14,0.08);
    --amber-bd:  rgba(146,64,14,0.20);
    --premium:   #B86A00;
}

/* Light mode: table rows and hover states */
body.light-mode .table-wrap tbody tr:hover        { background: rgba(160,130,80,0.05); }
body.light-mode .table-wrap tbody tr.premium-row  { background: rgba(184,106,0,0.04); }
body.light-mode .logo-text                         { color: #1C1A14; }
body.light-mode .nav-link                          { color: #4A3E28; }
body.light-mode .nav-link:hover                    { background: var(--bg3); color: #1C1A14; }
body.light-mode .site-header                       { box-shadow: 0 1px 3px rgba(160,130,80,0.12); }
body.light-mode .url-link                          { color: #1C1A14 !important; }
body.light-mode .m-url-link                        { color: #1C1A14 !important; }
body.light-mode .desc-cell,
body.light-mode .m-short-desc                      { color: #4A3E28; }
body.light-mode thead th                           { color: #7A6A4A; }

/* ── Theme toggle button ── */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); background: var(--accent-bg); }

html { font-size: 15px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ── SVG Icon definitions ──────────────────────────────────── */
/*
 * All icons are defined as inline SVG symbols in header.php
 * and referenced via <use href="#ic-..."> throughout the app.
 *
 * Available icons:
 *   #ic-free   – crossed-out $ (free)
 *   #ic-paid   – $ sign (not free)
 *   #ic-lock   – closed padlock (login required)
 *   #ic-unlock – open padlock (no login needed)
 *   #ic-ads    – megaphone (has ads)
 *   #ic-no-ads – crossed megaphone (no ads)
 */

/* ── Header hide on scroll (mobile) ── */
.site-header {
    transition: transform 0.25s ease;
}
.site-header.header-hidden {
    transform: translateY(-100%);
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Logo */
.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.site-logo:hover { text-decoration: none; }
.header-slogan-sep {
    color: var(--border2);
    font-size: 20px;
    font-weight: 200;
    margin: 0 10px;
    line-height: 1;
}
.header-slogan {
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    white-space: nowrap;
}
@media (max-width: 600px) {
    .header-slogan, .header-slogan-sep { display: none; }
}
.logo-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, #D97706, #F59E0B);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.logo-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}
.logo-text span { color: var(--accent2); }

/* Header nav */
.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-link {
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--muted2);
    transition: all 0.15s;
    border: 1px solid transparent;
    white-space: nowrap;
}
.nav-link:hover {
    color: var(--text);
    background: var(--bg3);
    text-decoration: none;
}
.nav-btn-primary {
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    background: var(--accent);
    color: #fff !important;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.nav-btn-primary:hover { opacity: 0.88; text-decoration: none; }
.nav-btn-outline {
    padding: 6px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    color: var(--muted2) !important;
    border: 1px solid var(--border2);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.nav-btn-outline:hover { border-color: var(--accent); color: var(--accent2) !important; text-decoration: none; }

/* User avatar badge */
.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted2);
}
.nav-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D97706, #F59E0B);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* Language switcher */
.lang-switcher { display:flex; align-items:center; }
.lang-select {
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 8px;
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    padding: 6px 26px 6px 10px;
    outline: none;
    cursor: pointer;
    font-family: var(--font);
    transition: border-color 0.15s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    color-scheme: dark;
}
body.light-mode .lang-select { color-scheme: light; }
.lang-select:hover { border-color: var(--accent); }
.lang-select:focus { border-color: var(--accent); }
.lang-select option {
    background: var(--bg3);
    color: var(--text);
}

/* ── Flash messages ───────────────────────────────────────── */
.flash {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    border-left: 3px solid;
}
.flash-success { background: var(--green-bg);  border-color: var(--green);  color: var(--green); }
.flash-error   { background: var(--red-bg);    border-color: var(--red);    color: var(--red); }
.flash-info    { background: var(--accent-bg); border-color: var(--accent); color: var(--accent2); }

/* ── Ad banner ────────────────────────────────────────────── */
.ad-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 2rem;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.04em;
}
.ad-label {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 7px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.badge svg { width: 11px; height: 11px; flex-shrink: 0; }

.badge-premium { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-bd); }
.badge-cat     { background: var(--accent-bg); color: var(--accent2); border: 1px solid rgba(217,119,6,0.2); }
.badge-yes     { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-bd); }
.badge-no      { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-bd); }
.badge-muted   { background: var(--bg3);       color: var(--muted2); border: 1px solid var(--border); }
.badge-ai      { background: var(--accent-bg); color: var(--accent2); border: 1px solid rgba(217,119,6,0.2); font-weight: 700; letter-spacing: -0.02em; }

/* Icon-only pill (mobile) */
.icon-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    flex-shrink: 0;
}
.icon-pill svg { width: 12px; height: 12px; }
.icon-pill.ip-green  { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-bd); }
.icon-pill.ip-red    { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-bd); }
.icon-pill.ip-amber  { background: var(--amber-bg);  color: var(--amber);  border: 1px solid var(--amber-bd); }
.icon-pill.ip-muted  { background: var(--bg3);       color: var(--muted2); border: 1px solid var(--border); }
.icon-pill.ip-accent { background: var(--accent-bg); color: var(--accent2); border: 1px solid rgba(217,119,6,0.2); font-size: 9px; font-weight: 700; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--accent);  color: #fff; }
.btn-primary:hover { background: #4f52d9; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border2); }
.btn-danger    { background: var(--red-bg);  color: var(--red); border: 1px solid var(--red-bd); }
.btn-danger:hover { background: rgba(239,68,68,0.18); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 7px; }
.btn-visit { background: var(--accent-bg); color: var(--accent2) !important; border: 1px solid rgba(217,119,6,0.25); }
.btn-visit:hover { background: var(--accent); color: #fff !important; }

/* Heart button */
.btn-heart {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.15s;
    color: var(--muted);
}
.btn-heart:hover  { background: var(--bg3); color: var(--red); }
.btn-heart.active { color: var(--red); }
.btn-heart:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted2);
    margin-bottom: 5px;
    letter-spacing: 0.01em;
}
.form-control {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 9px 12px;
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s;
    appearance: none;
}
.form-control:focus { border-color: var(--accent); }
textarea.form-control { resize: vertical; min-height: 100px; }
.field-error  { font-size: 12px; color: var(--red);    margin-top: 4px; }
.field-hint   { font-size: 12px; color: var(--muted);  margin-top: 4px; }
.char-count   { float: right; font-size: 11px; color: var(--muted); }

/* Checkbox item */
.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text);
}
.check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

/* Password strength bar */
.pw-strength     { height: 4px; border-radius: 2px; background: var(--bg3); margin-top: 6px; overflow: hidden; }
.pw-strength-bar { height: 100%; width: 0; transition: width 0.3s, background 0.3s; border-radius: 2px; }
.pw-hint         { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Auth pages ───────────────────────────────────────────── */
.auth-container { max-width: 440px; margin: 3rem auto; padding: 0 1rem; }
.auth-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}
.auth-box h2 { font-size: 1.3rem; margin-bottom: 4px; }
.auth-box .subtitle { font-size: 14px; color: var(--muted); margin-bottom: 1.5rem; }
.auth-links { margin-top: 1.25rem; text-align: center; font-size: 13px; color: var(--muted); }
.auth-links a { color: var(--accent2); }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── Cards / Boxes ────────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.card-sm { padding: 1rem 1.25rem; border-radius: var(--radius); }

/* ── Page layout ──────────────────────────────────────────── */
.page-container { max-width: 1300px; margin: 0 auto; padding: 1.5rem 2rem; }
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h2 { font-size: 1.3rem; font-weight: 600; }
.page-header p  { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap thead th {
    background: var(--bg3);
    padding: 10px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}
.table-wrap thead th:hover { color: var(--accent2); }
.table-wrap thead th.sorted { color: var(--accent2); }
.table-wrap thead th.sorted .sort-icon { opacity: 1; }
.sort-icon { opacity: 0.3; margin-left: 3px; font-size: 10px; }
.table-wrap tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.table-wrap tbody tr:last-child { border-bottom: none; }
.table-wrap tbody tr:hover { background: rgba(245,158,11,0.05); }
.table-wrap tbody tr.premium-row { background: rgba(252,211,77,0.04); border-left: 2px solid var(--amber); }
.table-wrap tbody tr.premium-row:hover { background: rgba(252,211,77,0.08); }
.table-wrap tbody tr.inactive { opacity: 0.45; }
.table-wrap td { padding: 10px 14px; vertical-align: middle; }

/* Site cell */
.site-cell { display: flex; align-items: center; gap: 10px; }
.site-favicon { width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0; }
.site-name { font-weight: 500; font-size: 13px; color: var(--text); }
.site-url  { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem; color: var(--muted); font-size: 14px; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    background: var(--bg2);
}
@media (max-width: 768px) {
    .site-footer {
        margin-top: 0;
        padding: 1.5rem 1rem;
        display: block !important;
    }
}
.site-footer a { color: var(--muted2); }

/* ── Mobile: Filter drawer ────────────────────────────────── */
.filter-drawer {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1rem 0.75rem;
    display: none;
}
.filter-drawer.open { display: block; }
.drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 0.75rem; }
.drawer-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.check-pills  { display: flex; gap: 6px; flex-wrap: wrap; }
.check-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted2);
    background: var(--bg3);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.check-pill.active { border-color: var(--accent); color: var(--accent2); background: var(--accent-bg); }

/* ── Mobile: compact list rows ────────────────────────────── */
.m-list { background: var(--bg2); border-top: 1px solid var(--border); }
.m-row {
    display: flex;
    align-items: center;
    padding: 9px 1rem;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}
.m-row:last-child { border-bottom: none; }
.m-row.premium-row { border-left: 2px solid var(--amber); background: rgba(245,158,11,0.025); }
.m-favicon { width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0; }
.m-row-main { flex: 1; min-width: 0; }
.m-row-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; flex-wrap: wrap; }
.m-row-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.m-row-icons { display: flex; align-items: center; gap: 3px; }
.m-row-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .site-header { padding: 0 1rem; }
    .desktop-only { display: none !important; }
    .page-container { padding: 1rem; }
}
@media (min-width: 769px) {
    .mobile-only { display: none !important; }
}
