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

/* ── LIGHT MODE (default) ───────────────────────────────────── */
:root {
  --bg: #f4f5f9;
  --bg2: #ffffff;
  --bg3: #eef0f8;
  --bg4: #e4e6f4;
  --border: rgba(0,0,0,.08);
  --border2: rgba(0,0,0,.15);
  --text: #111827;
  --muted: #6b7280;
  --muted2: #9ca3af;
  --accent: #4f46e5;
  --accent2: #4338ca;
  --accent-bg: rgba(79,70,229,.08);
  --pro: #b45309;
  --success: #059669;
  --success-bg: rgba(5,150,105,.1);
  --error: #dc2626;
  --error-bg: rgba(220,38,38,.08);
  --warn: #b45309;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --shadow-md: 0 4px 20px rgba(0,0,0,.09), 0 8px 32px rgba(0,0,0,.06);
  --navbar-bg: rgba(255,255,255,.97);
  --radius: 12px;
  --tr: .2s ease;
}

/* ── DARK MODE ──────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0f0f13;
  --bg2: #16161d;
  --bg3: #1e1e2a;
  --bg4: #252530;
  --border: rgba(255,255,255,.08);
  --border2: rgba(255,255,255,.15);
  --text: #e8e8f0;
  --muted: #6b6b80;
  --muted2: #9090a8;
  --accent: #6c63ff;
  --accent2: #5a52e0;
  --accent-bg: rgba(108,99,255,.12);
  --pro: #f5c542;
  --success: #43e8a0;
  --success-bg: rgba(67,232,160,.1);
  --error: #ff4d6d;
  --error-bg: rgba(255,77,109,.1);
  --warn: #f5c542;
  --shadow: 0 2px 12px rgba(0,0,0,.4);
  --shadow-md: 0 4px 24px rgba(0,0,0,.5);
  --navbar-bg: rgba(15,15,19,.92);
}

html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6;
  transition: background .25s, color .25s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .8; }
img { max-width: 100%; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 2rem; background: var(--navbar-bg);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  box-shadow: var(--shadow);
  gap: 1rem;
}
.logo { font-size: 1.35rem; font-weight: 800; color: var(--text); flex-shrink: 0; }
.logo span { color: var(--accent); }
.navbar-center { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { color: var(--muted); font-size: .9rem; font-weight: 500; transition: color var(--tr); white-space: nowrap; }
.nav-link:hover, .nav-link.active { color: var(--accent); opacity: 1; }
.nav-admin { background: var(--accent); color: #fff !important; padding: .25rem .75rem; border-radius: 6px; }
.navbar-right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
#nav-auth { display: flex; align-items: center; gap: .6rem; }

/* Theme Toggle */
.theme-toggle {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem; transition: all var(--tr); flex-shrink: 0;
  color: var(--text);
}
.theme-toggle:hover { background: var(--bg4); border-color: var(--accent); }

/* Hamburger */
.hamburger {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: .45rem; cursor: pointer; flex-direction: column;
  gap: 4px; width: 36px; height: 36px; align-items: center; justify-content: center;
}
.hamburger span {
  display: block; width: 18px; height: 2px; background: var(--text);
  border-radius: 2px; transition: all .3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile nav drawer */
.mobile-nav {
  display: none; position: fixed; top: 61px; left: 0; right: 0;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-md); z-index: 199; padding: 1rem 1.5rem;
  flex-direction: column; gap: .25rem;
}
.mobile-nav.open { display: flex; }
.mobile-nav .nav-link { padding: .65rem 0; border-bottom: 1px solid var(--border); font-size: .95rem; }
.mobile-nav .nav-link:last-child { border-bottom: none; }
.mobile-nav-auth { display: flex; gap: .75rem; margin-top: .75rem; flex-wrap: wrap; }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .navbar-center { display: none; }
  .navbar { padding: .75rem 1.25rem; }
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .55rem 1.25rem; border-radius: 8px; font-size: .9rem;
  font-weight: 600; cursor: pointer; border: none; transition: all var(--tr);
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); opacity: 1; transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }
.btn-danger { background: var(--error); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Hero (used on auth/simple pages — not homepage which has its own) ── */
.hero { text-align: center; padding: 5rem 2rem 3rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.15; margin-bottom: 1rem; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 520px; margin: 0 auto 2rem; }

/* ── Tools Grid ─────────────────────────────────────────────── */
.tools-page { max-width: 1200px; margin: 0 auto; padding: 1rem 2rem 4rem; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; margin-bottom: 4rem; }
.tool-card {
  position: relative; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column;
  gap: .75rem; transition: all var(--tr); overflow: hidden;
  box-shadow: var(--shadow);
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tool-icon { width: 52px; height: 52px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.tool-info h3 { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.tool-info p { font-size: .82rem; color: var(--muted); }
.tool-badge { position: absolute; top: 1rem; right: 1rem; font-size: .65rem; font-weight: 700; padding: .2rem .5rem; border-radius: 4px; text-transform: uppercase; letter-spacing: .05em; }
.badge-free { background: var(--success-bg); color: var(--success); }
.badge-new  { background: var(--accent-bg); color: var(--accent); }
.badge-pro  { background: rgba(217,119,6,.1); color: var(--pro); }
.tool-overlay-btn { margin-top: auto; font-size: .82rem; color: var(--accent); font-weight: 600; }
.tool-skeleton { background: var(--bg3); border-radius: var(--radius); height: 160px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:.6} 50%{opacity:1} }

/* ── Pricing ────────────────────────────────────────────────── */
.pricing-section { text-align: center; padding: 3rem 0; }
.pricing-section h2 { font-size: 2rem; font-weight: 800; margin-bottom: 2rem; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; max-width: 680px; margin: 0 auto; }
.pricing-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; position: relative; box-shadow: var(--shadow); }
.pricing-card-pro { border-color: var(--accent); }
.pro-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; padding: .2rem .75rem; border-radius: 20px; }
.pricing-card h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: .5rem; }
.price { font-size: 2.2rem; font-weight: 800; margin-bottom: 1.5rem; }
.price span { font-size: 1rem; color: var(--muted); font-weight: 400; }
.pricing-card ul { list-style: none; text-align: left; margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: .5rem; }
.pricing-card ul li::before { content: '✓ '; color: var(--success); }

/* ── Auth pages ─────────────────────────────────────────────── */
.auth-page { display: flex; flex-direction: column; min-height: 100vh; }
.auth-container { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-md);
}
.auth-card h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: .3rem; }
.auth-sub { color: var(--muted); margin-bottom: 1.75rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; color: var(--muted); font-size: .88rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .4rem; color: var(--muted); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: .6rem .85rem; font-size: .9rem;
  transition: border-color var(--tr);
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent); }
.form-group input:disabled { opacity: .6; cursor: not-allowed; }
.hint { font-size: .75rem; color: var(--muted); font-weight: 400; }
.error-msg { background: var(--error-bg); border: 1px solid rgba(220,38,38,.3); color: var(--error); padding: .6rem .9rem; border-radius: 8px; font-size: .85rem; margin-bottom: 1rem; }
.success-msg { background: var(--success-bg); border: 1px solid rgba(5,150,105,.3); color: var(--success); padding: .6rem .9rem; border-radius: 8px; font-size: .85rem; }
.hidden { display: none !important; }

/* ── Dashboard ──────────────────────────────────────────────── */
.dashboard-page { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.dashboard-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.dashboard-header h1 { font-size: 1.6rem; font-weight: 800; }
.plan-badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .6rem; border-radius: 20px; margin-top: .3rem; }
.badge-free { background: var(--bg4); color: var(--muted); }
.badge-pro  { background: rgba(217,119,6,.1); color: var(--pro); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .4rem; }
.stat-value { font-size: 1.5rem; font-weight: 800; }
.dashboard-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2rem; }
@media (max-width: 700px) { .dashboard-sections { grid-template-columns: 1fr; } }
.dash-section { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.dash-section h2 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.dash-section h3 { font-size: .9rem; font-weight: 700; margin-bottom: 1rem; }
.activity-item { display: flex; gap: .75rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .82rem; }
.activity-item:last-child { border-bottom: none; }
.activity-tool { background: var(--accent-bg); color: var(--accent); padding: .15rem .5rem; border-radius: 4px; font-weight: 600; font-size: .75rem; flex-shrink: 0; }
.activity-file { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { color: var(--muted); font-size: .75rem; flex-shrink: 0; }
.settings-form { display: flex; flex-direction: column; gap: .75rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.upgrade-banner { background: linear-gradient(135deg, rgba(108,99,255,.08), rgba(255,101,132,.06)); border: 1px solid rgba(108,99,255,.25); border-radius: var(--radius); padding: 1.5rem 2rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.upgrade-banner strong { display: block; font-size: 1.1rem; margin-bottom: .25rem; }
.upgrade-banner p { color: var(--muted); font-size: .88rem; }
.muted { color: var(--muted); font-size: .88rem; }

/* ── Download Limit Info Banner ─────────────────────────────── */
.download-limit-banner {
  background: linear-gradient(135deg, rgba(108,99,255,.07), rgba(5,150,105,.06));
  border: 1px solid rgba(108,99,255,.2); border-radius: 10px;
  padding: .85rem 1.1rem; margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  font-size: .85rem;
}
.download-limit-banner .dlb-icon { font-size: 1.2rem; flex-shrink: 0; }
.download-limit-banner .dlb-text { flex: 1; color: var(--text); }
.download-limit-banner .dlb-text strong { color: var(--accent); }
.download-limit-banner .dlb-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.download-limit-banner a.btn-sm { text-decoration: none; }

/* ── Toasts ─────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--bg2); border: 1px solid var(--border);
  padding: .8rem 1.25rem; border-radius: 10px; font-size: .88rem;
  opacity: 0; transform: translateY(8px); transition: all .3s;
  z-index: 9999; max-width: 320px; box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: rgba(5,150,105,.4); }
.toast-error   { border-color: rgba(220,38,38,.4); }
[data-theme="dark"] .toast-success { border-color: rgba(67,232,160,.4); }
[data-theme="dark"] .toast-error   { border-color: rgba(255,77,109,.4); }

/* ── Announcement bar ───────────────────────────────────────── */
.announcement-bar { background: var(--accent); color: #fff; text-align: center; padding: .5rem 1rem; font-size: .85rem; font-weight: 600; }

/* ── Footer ─────────────────────────────────────────────────── */
.footer { padding: 3rem 2rem 2rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); background: var(--bg2); }
.footer-inner { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; }
.footer-brand .logo { font-size: 1.3rem; display: block; margin-bottom: .5rem; }
.footer-brand p { font-size: .82rem; color: var(--muted); line-height: 1.6; max-width: 240px; }
.footer-col h4 { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted2); margin-bottom: .75rem; }
.footer-col a { display: block; color: var(--muted); font-size: .85rem; margin-bottom: .4rem; transition: color var(--tr); }
.footer-col a:hover { color: var(--accent); opacity: 1; }
.footer-bottom { max-width: 1100px; margin: 2rem auto 0; padding-top: 1.25rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-size: .78rem; }
@media(max-width:700px) { .footer-inner { grid-template-columns: 1fr 1fr; } }
@media(max-width:480px) { .footer-inner { grid-template-columns: 1fr; } .footer-bottom { flex-direction: column; text-align: center; } }

/* ── Download Gate Modal ────────────────────────────────────── */
.gate-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 9998; display: flex; align-items: center; justify-content: center; padding: 1.25rem;
  backdrop-filter: blur(4px);
}
.gate-modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  padding: 2rem; max-width: 420px; width: 100%; text-align: center;
  box-shadow: var(--shadow-md); animation: slideUp .25s ease;
}
@keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }
.gate-modal-icon { font-size: 2.5rem; margin-bottom: .75rem; display: block; }
.gate-modal h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: .4rem; }
.gate-modal p { color: var(--muted); font-size: .88rem; margin-bottom: 1.5rem; line-height: 1.6; }
.gate-modal-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.gate-modal-close { display: block; margin-top: .75rem; color: var(--muted); font-size: .82rem; background: none; border: none; cursor: pointer; }
.gate-modal-close:hover { color: var(--text); }

/* ── Ad slot ────────────────────────────────────────────────── */
.ad-slot { display: flex; align-items: center; justify-content: center; min-height: 90px; background: var(--bg3); border-top: 1px solid var(--border); }
