/* KolayYaz Web Panel — premium desktop-first UI */
:root {
  --navy: #0B1736;
  --navy-soft: #18264D;
  --navy-light: #EEF1FA;
  --gold: #F4B400;
  --gold-soft: #FFF4CC;
  --gold-border: rgba(244,180,0,.28);
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --text: #101828;
  --muted: #667085;
  --muted-2: #98A2B3;
  --border: #E4E7EC;
  --border-light: #F2F4F7;
  --danger: #B42318;
  --danger-soft: #FEF3F2;
  --success: #027A48;
  --success-soft: #ECFDF3;
  --sidebar-w: 268px;
  --topbar-h: 64px;
  --r-sm: 8px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow-md: 0 8px 24px rgba(16,24,40,.08);
  --shadow-lg: 0 20px 48px rgba(11,23,54,.12);
  --grad-navy: linear-gradient(135deg, #0B1736 0%, #1A2A55 100%);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { display: block; max-width: 100%; }

.app-root { min-height: 100dvh; }

/* ---- Boot / loading ---- */
.boot-screen, .page-loading {
  min-height: 100dvh; display: grid; place-items: center; gap: 16px; color: var(--muted);
}
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--navy); border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.lg { width: 48px; height: 48px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

.gen-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(11,23,54,.55); backdrop-filter: blur(6px);
  display: grid; place-items: center; gap: 14px; color: #fff;
  opacity: 0; pointer-events: none; transition: .25s;
}
.gen-overlay.show { opacity: 1; pointer-events: auto; }

/* ---- Shell layout ---- */
.shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 16px;
  position: sticky; top: 0; height: 100dvh; z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 800; color: var(--navy); margin-bottom: 28px; padding: 4px 8px;
}
.sidebar-brand b { color: var(--gold); }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: var(--r-md); font-weight: 600; font-size: 14.5px; color: var(--muted);
  transition: .2s;
}
.nav-item .ni { font-size: 18px; width: 22px; text-align: center; }
.nav-item:hover { background: var(--navy-light); color: var(--navy); }
.nav-item.active { background: var(--navy); color: #fff; }
.nav-item.locked { opacity: .75; }
.nav-item .lock { margin-left: auto; font-size: 12px; }
.sidebar-premium {
  margin: 16px 0; padding: 16px; border-radius: var(--r-md);
  background: var(--grad-navy); color: rgba(255,255,255,.88); font-size: 13px;
}
.sidebar-premium p { margin-bottom: 12px; line-height: 1.5; }
.sidebar-premium.is-prem { background: var(--gold-soft); color: #7a5900; text-align: center; }
.sidebar-user {
  display: flex; gap: 12px; align-items: center; padding: 12px 8px;
  border-top: 1px solid var(--border-light); margin-top: 8px;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--navy);
  color: #fff; display: grid; place-items: center; font-weight: 800; flex-shrink: 0;
}
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.u-name { font-weight: 700; font-size: 14px; color: var(--navy); }
.u-meta { font-size: 12px; color: var(--muted); }

.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 800; font-size: 17px; color: var(--navy); flex: 1; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; font-size: 18px; display: none;
}
.usage-strip {
  display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  background: var(--gold-soft); border-bottom: 1px solid var(--gold-border); font-size: 13px; font-weight: 600; color: #7a5900;
}
.usage-bar { flex: 1; max-width: 200px; height: 6px; background: rgba(0,0,0,.08); border-radius: 99px; overflow: hidden; }
.usage-fill { height: 100%; background: var(--gold); border-radius: 99px; transition: width .4s; }
.page-content { padding: 28px 24px 48px; flex: 1; max-width: 980px; width: 100%; margin: 0 auto; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-md); font-weight: 700; font-size: 14.5px;
  border: none; cursor: pointer; transition: .22s; white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-gold { background: var(--gold); color: var(--navy); box-shadow: var(--shadow-sm); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--navy-soft); }
.btn-ghost { background: var(--surface); color: var(--navy); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--navy); }
.btn-danger { background: var(--danger); color: #fff; }

/* ---- Typography blocks ---- */
.page-header { margin-bottom: 28px; }
.page-header.compact { margin-bottom: 20px; }
.page-header h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; color: var(--navy); line-height: 1.15; margin-top: 8px; }
.page-header .sub, .sub { color: var(--muted); font-size: 15px; margin-top: 6px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.eyebrow.light { color: rgba(255,255,255,.65); }
.back-link { background: none; border: none; color: var(--navy); font-weight: 700; cursor: pointer; font-size: 14px; margin-bottom: 8px; padding: 0; }
.back-link:hover { color: var(--gold); }
.section-block { margin-bottom: 36px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { font-size: 20px; font-weight: 800; color: var(--navy); }
.link-sm { font-size: 13px; font-weight: 700; color: var(--navy); }
.muted { color: var(--muted); font-size: 14px; }

/* ---- Hero card ---- */
.hero-card {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 24px 28px; border-radius: var(--r-xl); background: var(--grad-navy); color: #fff;
  margin-bottom: 32px; box-shadow: var(--shadow-lg);
}
.hero-card h2 { font-size: 22px; margin-bottom: 6px; }
.hero-card p { color: rgba(255,255,255,.78); font-size: 14.5px; max-width: 480px; }

/* ---- Categories / quick ---- */
.quick-row { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-chip {
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer; transition: .2s;
}
.quick-chip:hover { border-color: var(--navy); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.cat-card {
  text-align: left; padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; transition: .25s; box-shadow: var(--shadow-sm);
}
.cat-card:hover { border-color: var(--navy); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.cat-ic { font-size: 28px; display: block; margin-bottom: 12px; }
.cat-title { display: block; font-weight: 800; font-size: 16px; color: var(--navy); margin-bottom: 4px; }
.cat-desc { display: block; font-size: 13px; color: var(--muted); line-height: 1.45; }

.sub-grid { display: grid; gap: 12px; }
.sub-card {
  text-align: left; padding: 18px 20px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; transition: .2s; width: 100%;
}
.sub-card:hover:not(.locked) { border-color: var(--navy); box-shadow: var(--shadow-sm); }
.sub-card.locked { opacity: .85; }
.sub-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sub-title { font-weight: 800; color: var(--navy); font-size: 16px; flex: 1; }
.sub-desc { font-size: 14px; color: var(--muted); }

.recent-list { display: grid; gap: 10px; }
.recent-item {
  text-align: left; padding: 16px 18px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; transition: .2s; width: 100%;
}
.recent-item:hover { border-color: var(--navy); }
.ri-title { font-weight: 700; color: var(--navy); }
.ri-meta { font-size: 12px; color: var(--muted); margin: 4px 0; }
.ri-preview { font-size: 13px; color: var(--muted); }

/* ---- Form ---- */
.dyn-form { display: grid; gap: 18px; }
.form-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.fp-bar { flex: 1; height: 6px; background: var(--border-light); border-radius: 99px; overflow: hidden; }
.fp-fill { height: 100%; background: var(--navy); border-radius: 99px; transition: width .3s; }
.field label { display: block; font-weight: 700; font-size: 14px; color: var(--navy); margin-bottom: 8px; }
.field label .req { color: var(--danger); margin-left: 3px; font-weight: 800; }
.field small { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.field input[type=text], .field input[type=date], .field input[type=email], .field input[type=password],
.field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); transition: .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11,23,54,.08);
}
.field input[type=file] { font-size: 14px; }
.file-name { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--success); }
.req { color: var(--danger); }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.multi-select { display: grid; gap: 8px; }
.info-field { padding: 14px; background: var(--navy-light); border-radius: var(--r-md); font-size: 14px; color: var(--navy); }
.info-box { padding: 14px 16px; background: var(--gold-soft); border: 1px solid var(--gold-border); border-radius: var(--r-md); font-size: 13.5px; color: #7a5900; }
.form-section h3 { font-size: 16px; font-weight: 800; color: var(--navy); margin-bottom: 12px; }

.tone-group { margin-bottom: 14px; }
.tone-label { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 8px; }
.tone-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tone-chip {
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer; transition: .2s;
}
.tone-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tone-chip.locked { opacity: .75; }

/* ---- Result ---- */
.result-layout { max-width: 760px; }
.result-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 24px; box-shadow: var(--shadow-md); margin-bottom: 16px;
}
.result-card pre {
  white-space: pre-wrap; word-break: break-word; font-family: inherit;
  font-size: 15.5px; line-height: 1.75; color: var(--text);
}
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  padding: 9px 14px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer;
}
.chip-btn:hover:not(:disabled) { border-color: var(--navy); }
.rewrite-section { margin-bottom: 24px; }
.rewrite-section h3 { font-size: 17px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }

/* ---- Library ---- */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; background: var(--border-light); padding: 5px; border-radius: 999px; width: fit-content; }
.tab { padding: 10px 20px; border-radius: 999px; border: none; background: transparent; font-weight: 700; cursor: pointer; color: var(--muted); }
.tab.active { background: var(--navy); color: #fff; }
.lib-list { display: grid; gap: 10px; }
.lib-item {
  text-align: left; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; width: 100%; transition: .2s;
}
.lib-item:hover { border-color: var(--navy); }
.li-top { display: flex; justify-content: space-between; align-items: center; }
.li-meta { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.lib-item p { font-size: 13.5px; color: var(--muted); }

/* ---- Settings / privacy / premium ---- */
.account-card {
  display: flex; gap: 18px; align-items: center; padding: 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: 20px;
}
.settings-list { display: grid; gap: 8px; }
.setting-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; transition: .2s;
}
.setting-row:hover { border-color: var(--navy); }
.sr-ic { font-size: 22px; }
.sr-body { flex: 1; }
.sr-body strong { display: block; font-size: 15px; color: var(--navy); }
.sr-body small { color: var(--muted); font-size: 13px; }
.sr-arrow { color: var(--muted-2); }

.locked-page { text-align: center; padding: 48px 24px; max-width: 480px; margin: 0 auto; }
.locked-icon { font-size: 48px; margin-bottom: 16px; }
.locked-page h2 { font-size: 24px; color: var(--navy); margin-bottom: 10px; }
.locked-page p { color: var(--muted); margin-bottom: 24px; }
.locked-page .btn { margin: 6px; }

.premium-page { max-width: 640px; margin: 0 auto; }
.premium-hero {
  text-align: center; padding: 40px 28px; border-radius: var(--r-xl);
  background: var(--grad-navy); color: #fff; margin-bottom: 28px; box-shadow: var(--shadow-lg);
}
.premium-hero .crown { font-size: 36px; margin-bottom: 12px; }
.premium-hero h1 { font-size: clamp(24px, 4vw, 32px); line-height: 1.2; margin: 10px 0; }
.premium-hero p { color: rgba(255,255,255,.78); font-size: 15px; max-width: 420px; margin: 0 auto; }
.benefit-list { display: grid; gap: 10px; margin-bottom: 28px; }
.benefit-row {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.benefit-row .b-ic { font-size: 22px; }
.benefit-row strong { display: block; color: var(--navy); }
.benefit-row p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.benefit-row .check { color: var(--success); font-weight: 800; margin-left: auto; }
.plan-section h3 { font-size: 16px; font-weight: 800; margin-bottom: 12px; color: var(--navy); }
.plan-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); margin-bottom: 10px;
}
.plan-card.featured { border-color: var(--gold); background: var(--gold-soft); }
.plan-card strong { display: block; color: var(--navy); }
.plan-card span { font-size: 13px; color: var(--muted); }
.plan-card .price { font-size: 22px; font-weight: 800; color: var(--navy); }
.premium-cta { margin-top: 28px; }
.premium-cta .trust { text-align: center; font-size: 12.5px; color: var(--muted); margin: 14px 0; }

.privacy-page h2 { font-size: 24px; color: var(--navy); margin-bottom: 8px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 28px; }
.metric { text-align: center; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.metric .mv { font-size: 24px; font-weight: 800; color: var(--navy); }
.metric .ml { font-size: 12px; color: var(--muted); font-weight: 600; }
.privacy-section { margin-bottom: 24px; }
.privacy-section h3 { font-size: 16px; font-weight: 800; color: var(--navy); margin-bottom: 10px; }
.privacy-section ul { padding-left: 18px; color: var(--muted); font-size: 14px; }
.ret-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-light); font-size: 14px; }
.privacy-actions { display: grid; gap: 10px; }
.privacy-btn {
  text-align: left; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; width: 100%;
}
.privacy-btn strong { display: block; color: var(--navy); margin-bottom: 2px; }
.privacy-btn span { font-size: 13px; color: var(--muted); }
.privacy-btn.danger { border-color: #FECDCA; background: var(--danger-soft); }
.privacy-btn.danger strong { color: var(--danger); }

.referral-page h2 { font-size: 24px; color: var(--navy); }
.ref-code-box { margin: 24px 0; padding: 20px; background: var(--navy-light); border-radius: var(--r-md); text-align: center; }
.ref-code-box .lbl { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.ref-code-box .code { font-size: 28px; font-weight: 800; color: var(--navy); letter-spacing: .08em; margin-top: 6px; }
.ref-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.stat { text-align: center; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.stat .sv { font-size: 22px; font-weight: 800; color: var(--navy); }
.stat .sl { font-size: 12px; color: var(--muted); }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input { flex: 1; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); }

.badge-prem, .badge-prem-sm {
  display: inline-block; font-size: 11px; font-weight: 800; color: #9a7100;
  background: var(--gold-soft); border: 1px solid var(--gold-border); padding: 2px 9px; border-radius: 999px;
}
.badge-prem-sm { font-size: 10px; padding: 2px 7px; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state h2 { color: var(--navy); margin-bottom: 8px; }

.skeleton-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.sk-card { height: 120px; border-radius: var(--r-lg); background: linear-gradient(90deg, #eef1f6, #f8f9fb, #eef1f6); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- Toast & modal ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: var(--r-md);
  font-weight: 600; font-size: 14px; z-index: 9999; opacity: 0; pointer-events: none; transition: .3s;
  box-shadow: var(--shadow-lg); max-width: min(90vw, 420px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.modal-overlay {
  position: fixed; inset: 0; z-index: 9990; background: rgba(11,23,54,.5);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--r-lg); padding: 28px; max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 20px; color: var(--navy); margin-bottom: 10px; }
.modal p { color: var(--muted); font-size: 14.5px; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .28s; box-shadow: var(--shadow-lg);
  }
  .shell.sidebar-open .sidebar { transform: translateX(0); }
  .shell.sidebar-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(11,23,54,.4); z-index: 35;
  }
  .menu-btn { display: grid; place-items: center; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-card { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .page-content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
  .cat-grid { grid-template-columns: 1fr; }
  .ref-stats { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; }
}
