/**
 * IshuSEO Analyzer - Dashboard / Auth / Membership UI
 * Loaded after app.css
 */

/* ---------- Base / breakout ---------- */
body:not(.wp-admin) .ishuseo-wrapper {
  width: auto;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  max-width: 100vw;
  min-height: 100vh;
  position: relative;
}
.wp-admin .ishuseo-wrapper { min-height: 80vh; border-radius: 14px; overflow: hidden; border: 1px solid var(--ishu-border); }
.ishuseo-wrapper *, .ishuseo-wrapper *::before, .ishuseo-wrapper *::after { box-sizing: border-box; }
.ishuseo-wrapper button { font-family: inherit; cursor: pointer; }
.ishuseo-wrapper [hidden] { display: none !important; }
.ishuseo-muted { color: var(--ishu-text-muted); font-size: 13px; margin: 8px 0; }
.ishuseo-full { width: 100%; }

/* ---------- Shell ---------- */
.ishuseo-shell { display: flex; min-height: 100vh; background: #F1F5F9; }
.wp-admin .ishuseo-shell { min-height: 80vh; }

.ishuseo-sidebar {
  width: 268px; flex: 0 0 268px;
  background: linear-gradient(180deg, #0F172A 0%, #1E1B4B 100%);
  color: #CBD5E1; padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 60;
}
.wp-admin .ishuseo-sidebar { height: auto; min-height: 80vh; position: static; }
.ishuseo-sidebar .ishuseo-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; text-decoration: none; }
.ishuseo-sidebar .ishuseo-brand h2 { color: #fff; font-size: 16px; margin: 0; font-weight: 800; line-height: 1.2; }
.ishuseo-sidebar .ishuseo-brand h2 span { color: #67E8F9; }
.ishuseo-sidebar .ishuseo-brand p { color: #94A3B8; font-size: 11px; margin: 0; letter-spacing: .04em; text-transform: uppercase; }
.ishuseo-brand-logo {
  width: 40px; height: 40px; border-radius: 12px; background: var(--ishu-gradient);
  color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(124, 58, 237, .45); flex: 0 0 auto;
}
.ishuseo-brand-logo.big { width: 64px; height: 64px; font-size: 24px; border-radius: 18px; margin-bottom: 18px; }

.ishuseo-side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.ishuseo-side-link {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: transparent; border: 0; color: #CBD5E1; text-align: left;
  padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  transition: background .15s, color .15s, transform .15s;
}
.ishuseo-side-link i { font-style: normal; font-size: 17px; width: 22px; text-align: center; }
.ishuseo-side-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.ishuseo-side-link.active { background: var(--ishu-gradient); color: #fff; box-shadow: 0 8px 20px rgba(124, 58, 237, .35); }
.ishuseo-side-link.logout { margin-top: 8px; color: #FCA5A5; }
.ishuseo-side-link.logout:hover { background: rgba(220, 38, 38, .15); }

.ishuseo-side-usage {
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 14px; padding: 14px; margin-top: 12px;
}
.ishuseo-side-usage-head { display: flex; justify-content: space-between; color: #fff; font-size: 13px; margin-bottom: 8px; }
.ishuseo-side-usage-head b { color: #67E8F9; }
.ishuseo-meter { height: 8px; background: rgba(148, 163, 184, .25); border-radius: 99px; overflow: hidden; }
.ishuseo-meter > div { height: 100%; background: var(--ishu-gradient); border-radius: 99px; transition: width .5s; }
.ishuseo-meter > div.full { background: linear-gradient(90deg, #F59E0B, #DC2626); }
.ishuseo-meter > div.pro { background: linear-gradient(90deg, #22C55E, #06B6D4); }
.ishuseo-meter.lg { height: 12px; background: #E2E8F0; margin: 12px 0; }
.ishuseo-upgrade-btn {
  width: 100%; margin-top: 12px; border: 0; padding: 10px; border-radius: 10px;
  background: #fff; color: #6D28D9; font-weight: 800; font-size: 13px;
}
.ishuseo-upgrade-btn:hover { background: #EDE9FE; }

/* ---------- Main + topbar ---------- */
.ishuseo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ishuseo-topbar {
  display: flex; align-items: center; gap: 16px; padding: 16px 32px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ishu-border); position: sticky; top: 0; z-index: 50;
}
.wp-admin .ishuseo-topbar { position: static; }
.ishuseo-topbar-title { flex: 1; min-width: 0; }
.ishuseo-topbar-title h1 { margin: 0; font-size: 22px; font-weight: 800; color: var(--ishu-dark); line-height: 1.2; }
.ishuseo-topbar-title p { margin: 2px 0 0; font-size: 13px; color: var(--ishu-text-muted); }
.ishuseo-topbar-right { display: flex; align-items: center; gap: 14px; }
.ishuseo-pill-btn {
  border: 0; background: var(--ishu-gradient); color: #fff; font-weight: 700; font-size: 13px;
  padding: 9px 16px; border-radius: 99px; box-shadow: 0 6px 16px rgba(124, 58, 237, .3);
}
.ishuseo-user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid var(--ishu-border); background: #fff; }
.ishuseo-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--ishu-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
}
.ishuseo-avatar.lg { width: 60px; height: 60px; font-size: 20px; }
.ishuseo-user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.ishuseo-user-meta b { font-size: 13px; color: var(--ishu-dark); }
.ishuseo-user-meta small { font-size: 11px; color: var(--ishu-text-muted); }
.ishuseo-burger { display: none; border: 1px solid var(--ishu-border); background: #fff; border-radius: 10px; width: 40px; height: 40px; font-size: 18px; }

.ishuseo-content { padding: 28px 32px 10px; flex: 1; }
.ishuseo-view { display: none; animation: ishuFade .25s ease; }
.ishuseo-view.active { display: block; }
@keyframes ishuFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Re-skin the legacy audit page inside the shell */
.ishuseo-shell .ishuseo-container { padding: 0; max-width: none; }
.ishuseo-shell .ishuseo-hero {
  background: #fff; border: 1px solid var(--ishu-border); border-radius: 20px;
  padding: 30px 28px; margin-bottom: 24px; text-align: left; box-shadow: var(--ishu-shadow-sm);
}
.ishuseo-shell .ishuseo-hero h1 { font-size: 28px; }
.ishuseo-shell .ishuseo-hero .subtitle { margin-left: 0; margin-right: 0; }
.ishuseo-shell .ishuseo-chips-row { justify-content: flex-start; }
.ishuseo-shell .ishuseo-card { border-radius: 16px; box-shadow: var(--ishu-shadow-sm); }
.ishuseo-mobile-nav, .ishuseo-navbar { display: none !important; }
.ishuseo-shell .ishuseo-footer { background: transparent; border-top: 1px solid var(--ishu-border); margin-top: 20px; padding: 18px; }

/* ---------- Dashboard ---------- */
.ishuseo-welcome {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--ishu-gradient); color: #fff; border-radius: 20px; padding: 26px 30px; margin-bottom: 22px;
  position: relative; overflow: hidden; box-shadow: 0 14px 34px rgba(124, 58, 237, .28);
}
.ishuseo-welcome::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.ishuseo-welcome h2 { margin: 0 0 4px; color: #fff; font-size: 24px; font-weight: 800; }
.ishuseo-welcome p { margin: 0; opacity: .92; }
.ishuseo-welcome .ishuseo-btn-submit { background: #fff; color: #6D28D9; position: relative; z-index: 1; box-shadow: 0 6px 18px rgba(0, 0, 0, .15); }

.ishuseo-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.ishuseo-kpi {
  background: #fff; border: 1px solid var(--ishu-border); border-radius: 16px; padding: 18px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--ishu-shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.ishuseo-kpi:hover { transform: translateY(-2px); box-shadow: var(--ishu-shadow-md); }
.ishuseo-kpi small { display: block; color: var(--ishu-text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.ishuseo-kpi b { font-size: 28px; font-weight: 800; color: var(--ishu-dark); line-height: 1.1; }
.ishuseo-kpi-ic { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.ishuseo-kpi-ic.v { background: #EDE9FE; } .ishuseo-kpi-ic.c { background: #CFFAFE; }
.ishuseo-kpi-ic.g { background: #DCFCE7; } .ishuseo-kpi-ic.r { background: #FEE2E2; }

.ishuseo-dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.ishuseo-dash-grid .ishuseo-card { margin: 0; }
.ishuseo-span-2 { grid-column: span 2; }
.ishuseo-card-title small { font-weight: 500; color: var(--ishu-text-muted); font-size: 12px; margin-left: 8px; }
.ishuseo-link-btn { background: none; border: 0; color: var(--ishu-primary); font-weight: 700; font-size: 13px; }

.ishuseo-chart { width: 100%; }
.ishuseo-svg-chart { width: 100%; height: 240px; display: block; }
.ishuseo-svg-chart text { font-size: 11px; fill: #94A3B8; }
.ishuseo-svg-chart .grid { stroke: #E2E8F0; stroke-dasharray: 3 4; }
.ishuseo-svg-chart .line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ishuseo-svg-chart .dot { fill: #fff; stroke: #7C3AED; stroke-width: 3; }

.ishuseo-bar-row { margin-bottom: 12px; }
.ishuseo-bar-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.ishuseo-bar { height: 8px; background: #E2E8F0; border-radius: 99px; overflow: hidden; }
.ishuseo-bar > div { height: 100%; background: var(--ishu-gradient); border-radius: 99px; }

.ishuseo-plan-badge { display: inline-block; padding: 4px 12px; border-radius: 99px; background: #F1F5F9; color: #475569; font-size: 12px; font-weight: 800; }
.ishuseo-plan-badge.pro { background: linear-gradient(135deg, #FDE68A, #FBBF24); color: #78350F; }
.ishuseo-usage-big { font-size: 34px; font-weight: 800; color: var(--ishu-dark); margin-top: 10px; }
.ishuseo-usage-big small { font-size: 13px; color: var(--ishu-text-muted); font-weight: 600; }

.ishuseo-table-wrap { overflow-x: auto; }
.ishuseo-recent { width: 100%; border-collapse: collapse; }
.ishuseo-recent th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ishu-text-muted); padding: 8px 10px; border-bottom: 1px solid var(--ishu-border); }
.ishuseo-recent td { padding: 12px 10px; border-bottom: 1px solid #F1F5F9; font-size: 14px; vertical-align: middle; }
.ishuseo-recent td small { display: block; color: var(--ishu-text-muted); font-size: 12px; }
.ishuseo-recent td b { word-break: break-all; }

.ishuseo-score-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; padding: 4px 10px; border-radius: 99px; font-weight: 800; font-size: 13px; }
.ishuseo-score-pill.good { background: #DCFCE7; color: #166534; }
.ishuseo-score-pill.mid { background: #FEF3C7; color: #92400E; }
.ishuseo-score-pill.bad { background: #FEE2E2; color: #991B1B; }
.ishuseo-score-pill.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 18px; flex: 0 0 auto; }

.ishuseo-history-item { display: flex; align-items: center; gap: 16px; padding: 14px 4px; border-bottom: 1px solid #F1F5F9; }
.ishuseo-history-item:last-child { border-bottom: 0; }
.ishuseo-history-main { flex: 1; min-width: 0; }
.ishuseo-history-main b { display: block; word-break: break-all; color: var(--ishu-dark); }
.ishuseo-history-main small { color: var(--ishu-text-muted); font-size: 12px; }
.ishuseo-history-actions { display: flex; gap: 8px; }
.ishuseo-btn.danger { color: #DC2626; }

.ishuseo-empty { text-align: center; padding: 30px 10px; color: var(--ishu-text-muted); }
.ishuseo-empty > div { font-size: 34px; }
.ishuseo-empty b { display: block; color: var(--ishu-dark); margin-top: 6px; }
.ishuseo-empty.small { padding: 20px 0; }

/* ---------- Membership / plans ---------- */
.ishuseo-plan-hero { text-align: center; margin-bottom: 24px; }
.ishuseo-plan-hero h2 { font-size: 28px; font-weight: 800; margin: 0 0 6px; color: var(--ishu-dark); }
.ishuseo-plan-hero p { color: var(--ishu-text-muted); margin: 0; }
.ishuseo-status-bar { max-width: 760px; margin: 0 auto 22px; padding: 12px 18px; border-radius: 12px; background: #EFF6FF; color: #1E40AF; text-align: center; font-size: 14px; }
.ishuseo-status-bar.pro { background: #DCFCE7; color: #166534; }
.ishuseo-plans-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; max-width: 760px; margin: 0 auto; }
.ishuseo-plan {
  background: #fff; border: 2px solid var(--ishu-border); border-radius: 22px; padding: 30px 26px 26px; position: relative;
  transition: transform .2s, box-shadow .2s;
}
.ishuseo-plan:hover { transform: translateY(-4px); box-shadow: var(--ishu-shadow-lg); }
.ishuseo-plan.featured { border-color: transparent; background: linear-gradient(#fff, #fff) padding-box, var(--ishu-gradient) border-box; box-shadow: var(--ishu-shadow-lg); }
.ishuseo-plan-ribbon { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--ishu-gradient); color: #fff; font-size: 11px; font-weight: 800; padding: 5px 14px; border-radius: 99px; white-space: nowrap; letter-spacing: .04em; }
.ishuseo-plan h4 { margin: 0; font-size: 18px; color: var(--ishu-dark); }
.ishuseo-plan-price { font-size: 46px; font-weight: 800; color: var(--ishu-dark); margin: 10px 0 0; line-height: 1; }
.ishuseo-plan-price span { font-size: 22px; vertical-align: top; margin-right: 2px; color: var(--ishu-primary); }
.ishuseo-plan-price small { font-size: 14px; color: var(--ishu-text-muted); font-weight: 600; }
.ishuseo-plan ul { list-style: none; padding: 0; margin: 16px 0 22px; }
.ishuseo-plan li { padding: 5px 0; font-size: 14px; color: #334155; }
.ishuseo-fineprint { text-align: center; color: var(--ishu-text-muted); font-size: 12px; margin-top: 20px; }

.ishuseo-account-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }

/* ---------- Toast ---------- */
.ishuseo-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: #111827; color: #fff; padding: 12px 22px; border-radius: 12px; font-size: 14px; font-weight: 600;
  z-index: 99999; transition: all .3s; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.ishuseo-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Auth ---------- */
.ishuseo-auth { min-height: 100vh; display: flex; background: #fff; }
.wp-admin .ishuseo-auth { min-height: 80vh; }
.ishuseo-auth-brand {
  flex: 1 1 46%; background: linear-gradient(140deg, #4C1D95 0%, #7C3AED 45%, #06B6D4 100%);
  color: #fff; display: flex; align-items: center; justify-content: center; padding: 50px; position: relative; overflow: hidden;
}
.ishuseo-auth-brand::before, .ishuseo-auth-brand::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .09); }
.ishuseo-auth-brand::before { width: 380px; height: 380px; right: -120px; top: -100px; }
.ishuseo-auth-brand::after { width: 260px; height: 260px; left: -80px; bottom: -80px; }
.ishuseo-auth-brand-inner { max-width: 440px; position: relative; z-index: 1; }
.ishuseo-auth-brand h1 { font-size: 40px; line-height: 1.1; margin: 0 0 14px; color: #fff; font-weight: 800; }
.ishuseo-auth-brand h1 span { color: #A5F3FC; }
.ishuseo-auth-brand .lead { font-size: 17px; opacity: .93; margin: 0 0 26px; }
.ishuseo-auth-points { list-style: none; padding: 0; margin: 0 0 30px; }
.ishuseo-auth-points li { padding: 8px 0; font-size: 16px; display: flex; gap: 12px; align-items: center; }
.ishuseo-auth-points li span { width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, .22); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.ishuseo-auth-foot { font-size: 13px; opacity: .8; }

.ishuseo-auth-panel { flex: 1 1 54%; display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #F8FAFC; }
.ishuseo-auth-card { width: 100%; max-width: 460px; background: #fff; border-radius: 24px; padding: 34px; box-shadow: 0 24px 60px rgba(15, 23, 42, .1); border: 1px solid var(--ishu-border); }
.ishuseo-auth-tabs { display: flex; background: #F1F5F9; border-radius: 14px; padding: 4px; margin-bottom: 22px; }
.ishuseo-auth-tabs button { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 11px; font-weight: 700; color: #64748B; font-size: 14px; }
.ishuseo-auth-tabs button.active { background: #fff; color: var(--ishu-primary); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.ishuseo-auth-form h2 { margin: 0; font-size: 24px; font-weight: 800; color: var(--ishu-dark); }
.ishuseo-auth-form .sub { margin: 4px 0 18px; color: var(--ishu-text-muted); font-size: 14px; }
.ishuseo-auth-form label { display: block; font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 14px; }
.ishuseo-auth-form label small { font-weight: 500; color: #94A3B8; }
.ishuseo-auth-form input[type=text], .ishuseo-auth-form input[type=email], .ishuseo-auth-form input[type=tel], .ishuseo-auth-form input[type=password] {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border: 1.5px solid var(--ishu-border); border-radius: 12px;
  font-size: 15px; background: #fff; color: var(--ishu-dark); outline: none; transition: border-color .15s, box-shadow .15s; height: auto;
}
.ishuseo-auth-form input:focus { border-color: var(--ishu-primary); box-shadow: 0 0 0 4px rgba(124, 58, 237, .12); }
.ishuseo-auth-form input.invalid { border-color: #DC2626; box-shadow: 0 0 0 4px rgba(220, 38, 38, .1); }
.ishuseo-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ishuseo-pass { position: relative; display: block; }
.ishuseo-pass input { padding-right: 46px !important; }
.ishuseo-eye { position: absolute; right: 6px; top: 12px; border: 0; background: none; font-size: 16px; opacity: .6; }
.ishuseo-row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; font-size: 13px; }
.ishuseo-check { display: flex !important; align-items: center; gap: 8px; margin: 0 !important; font-weight: 600 !important; }
.ishuseo-link, .ishuseo-switch a { color: var(--ishu-primary); font-weight: 700; text-decoration: none; }
.ishuseo-switch { text-align: center; font-size: 14px; color: var(--ishu-text-muted); margin: 18px 0 0; }
.ishuseo-auth-msg { padding: 11px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; font-weight: 600; }
.ishuseo-auth-msg.error { background: #FEE2E2; color: #991B1B; }
.ishuseo-auth-msg.success { background: #DCFCE7; color: #166534; }
body.ishuseo-auth-open { overflow-x: hidden; }

.ishuseo-sidebar-scrim { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .ishuseo-kpis { grid-template-columns: repeat(2, 1fr); }
  .ishuseo-dash-grid { grid-template-columns: 1fr 1fr; }
  .ishuseo-span-2 { grid-column: span 2; }
}
@media (max-width: 900px) {
  .ishuseo-sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-105%); transition: transform .25s; box-shadow: 10px 0 40px rgba(0, 0, 0, .3); }
  .ishuseo-sidebar.open { transform: none; }
  .ishuseo-sidebar.open ~ .ishuseo-main { pointer-events: none; }
  .ishuseo-burger { display: inline-flex; align-items: center; justify-content: center; }
  .ishuseo-topbar { padding: 12px 16px; }
  .ishuseo-topbar-title h1 { font-size: 18px; }
  .ishuseo-topbar-title p, .ishuseo-user-meta, #ishuseo-top-upgrade { display: none; }
  .ishuseo-content { padding: 18px 14px 6px; }
  .ishuseo-auth { flex-direction: column; }
  .ishuseo-auth-brand { padding: 34px 24px; flex: none; }
  .ishuseo-auth-brand h1 { font-size: 30px; }
  .ishuseo-auth-points { display: none; }
}
@media (max-width: 640px) {
  .ishuseo-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ishuseo-kpi { padding: 14px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .ishuseo-kpi b { font-size: 24px; }
  .ishuseo-dash-grid { grid-template-columns: 1fr; }
  .ishuseo-span-2 { grid-column: auto; }
  .ishuseo-plans-grid { grid-template-columns: 1fr; }
  .ishuseo-grid-2 { grid-template-columns: 1fr; gap: 0; }
  .ishuseo-auth-card { padding: 24px 20px; }
  .ishuseo-history-item { flex-wrap: wrap; }
  .ishuseo-history-actions { width: 100%; }
  .ishuseo-welcome { padding: 20px; }
}
