/**
 * ui-polish.css — ClickShield Final Polish v4.0
 * Resolves cascade conflicts, public body background, mobile fixes
 */

/* ---- Public body: clean gradient + subtle dot grid ---- */
body.public-body {
  background:
    radial-gradient(circle at 100% 0%, rgba(0,190,173,.06) 0%, transparent 30%),
    radial-gradient(circle at 0% 100%, rgba(0,158,142,.04) 0%, transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f5f9fc 100%);
  color: #0c1420;
}

body.public-body main#main-content { padding-bottom: 0; }

/* ---- Topbar height: public 72px ---- */
.public-nav { min-height: 72px; }

.public-brand-icon { width: 38px; height: 38px; border-radius: 11px; }

/* ---- Mobile nav position ---- */
.mobile-nav {
  position: relative;
  z-index: 49;
}

/* ---- Panel / Admin body backgrounds ---- */
body.panel-body {
  background: #e8edf6;
}

body.admin-body {
  background: #f0ecf8;
}

/* ---- Panel shell gap ---- */
.pnl-shell { gap: 0; }

/* ---- Dashboard live section ---- */
.dashboard-live-section { margin-bottom: 24px; }

/* ---- Impersonation banner offset ---- */
.impersonation-banner { top: 72px; }

/* ---- Panel topbar refinement ---- */
.pnl-topbar {
  min-height: 64px;
}

/* ---- Buttons: ensure width:100% only on mobile ---- */
@media (min-width: 769px) {
  .btn-full { width: 100%; }
  .btn { width: auto; }
}

/* ---- Public topbar active state ---- */
.public-nav nav a.active {
  color: var(--brand-700, #005b52);
  background: var(--brand-50, #e6faf8);
  font-weight: 600;
}

/* ---- Footer fix ---- */
body.public-body .site-footer {
  background:
    radial-gradient(circle at top center, rgba(0,190,173,.10), transparent 28%),
    linear-gradient(180deg, #080f1e 0%, #0a1828 60%, #080e1b 100%);
  color: rgba(220,230,245,.9);
  margin-top: clamp(72px, 8vw, 112px);
  padding: 80px 0 36px;
}

body.public-body .footer-grid {
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: clamp(22px, 2.6vw, 44px);
}

body.public-body .footer-brand,
body.public-body .footer-grid-col strong,
body.public-body .footer-grid-col a,
body.public-body .footer-bottom,
body.public-body .footer-desc { color: inherit; }

body.public-body .footer-grid-col strong {
  font-size: .62rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .4;
  margin-bottom: 14px;
  display: block;
}

body.public-body .footer-grid-col a { opacity: .55; font-weight: 500; margin-bottom: 12px; display: block; }
body.public-body .footer-grid-col a:hover { opacity: 1; color: var(--brand-300, #08cfc0); }

body.public-body .footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.07);
  opacity: .42;
  font-size: .82rem;
}

/* ---- Hero: home page ---- */
.page-public-home .hero { padding-block: clamp(72px, 9vw, 110px) clamp(56px, 7vw, 84px); }
.page-public-home .hero h1 { max-width: 14ch; }
.page-public-home .hero .lead { font-size: clamp(1rem, 1.4vw, 1.1rem); }

/* ---- Cards hover subtle lift ---- */
body.public-body .feature-card:hover,
body.public-body .price-card:hover,
body.public-body .testimonial-card:hover { transform: translateY(-4px); }

/* ---- Section compact heading ---- */
.section-heading.compact-heading {
  text-align: center;
  justify-content: center;
}
.section-heading.compact-heading p { margin-inline: auto; max-width: 68ch; }

/* ---- Stats inline: home page card variant ---- */
.page-public-home .stats-inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid rgba(12,20,32,.08);
}

.page-public-home .stats-inline-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(247,250,252,.96));
  border: 1px solid rgba(12,20,32,.07);
  box-shadow: 0 8px 24px rgba(6,12,21,.07);
  border-right: none !important;
  margin-right: 0 !important;
}

.page-public-home .stats-inline-item strong { font-size: clamp(1.1rem, 1.8vw, 1.45rem); }
.page-public-home .stats-inline-item span  { font-size: .82rem; color: var(--n500, #5f718f); }

/* ---- Panel preview section ---- */
.panel-preview-section { padding-block: 80px; }

/* ---- FAQ section ---- */
.faq-section-light { background: linear-gradient(180deg, #f5faff 0%, #edf7f5 100%); }

/* ============================================================
   RESPONSIVE FINAL
   ============================================================ */

/* ---- 1100px ---- */
@media (max-width: 1100px) {
  .feature-grid,
  .pricing-grid { grid-template-columns: 1fr !important; }

  body.public-body .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-public-home .stats-inline { grid-template-columns: 1fr !important; }
}

/* ---- 900px ---- */
@media (max-width: 900px) {
  .page-public-home .hero h1 { max-width: none; }
  .panel-preview-grid { grid-template-columns: 1fr; }
}

/* ---- 720px ---- */
@media (max-width: 720px) {
  .public-nav { min-height: 64px; }
  body.public-body .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  body.public-body .footer-bottom { flex-direction: column; align-items: flex-start; }
  .btn { width: 100%; }
  .hero-actions, .inline-actions { display: grid; }
  .mobile-actions .btn { width: 100%; }
}

/* ---- 560px ---- */
@media (max-width: 560px) {
  .container, .narrow { width: calc(100% - 24px); }
  .hero-actions { flex-direction: column; }
  .card, .panel-card, .form-card, .price-card, .feature-card, .auth-card,
  .welcome-hero, .page-hero { border-radius: 20px; }
}


/* ---- v4.1 corrective polish for missing shell primitives ---- */
.page-public-home .hero-card,
.page-public-pricing .price-card,
.page-panel-dashboard .dashboard-live-card,
.page-panel-dashboard .dashboard-chart-card,
.page-admin-production-tests .prod-test-card,
.page-admin-site-settings .form-card,
.page-admin-users .form-card,
.page-panel-guide .glass-card {
  box-shadow: 0 24px 56px rgba(15,23,42,.08);
}

.page-panel-dashboard .module-card,
.page-admin-index .stat-card,
.page-admin-packages .card,
.page-panel-billing .card,
.page-panel-team .card,
.page-panel-rules .card,
.page-panel-domains .card,
.page-panel-reports .card,
.page-panel-integrations .card {
  min-width: 0;
}

.page-panel-guide .glass-card .card > div[style],
.page-panel-guide .glass-card .card[style],
.page-panel-dashboard [style*="margin-top"],
.page-panel-dashboard [style*="text-align:right"],
.page-admin-system-audit [style*="margin-top"],
.page-panel-system-audit [style*="margin-top"] {
  max-width: 100%;
}

@media (max-width: 900px) {
  .page-admin-users .table-shell td:last-child,
  .page-admin-system-check .data-table td:last-child,
  .page-admin-system-audit .data-table td:last-child,
  .page-panel-system-check .data-table td:last-child,
  .page-panel-system-audit .data-table td:last-child,
  .page-panel-team .table-shell td:last-child {
    min-width: 220px;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .page-public-home .hero-card,
  .page-panel-guide .glass-card,
  .page-admin-production-tests .prod-test-card,
  .page-admin-site-settings .form-card,
  .page-panel-dashboard .dashboard-live-card,
  .page-panel-dashboard .dashboard-chart-card {
    padding: 18px 16px;
  }
}


/* ---- v4.2 ux + performance polish ---- */
html { scroll-behavior: smooth; }
img { max-width: 100%; height: auto; }
.btn.is-busy { pointer-events: none; opacity: .78; }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); border: 0; background: transparent; color: var(--n500, #64748b); cursor: pointer; }
/* table-shell and data-table-wrap must always scroll horizontally */
.table-shell, .data-table-wrap, .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#panelApp.is-loading, .pnl-main[aria-busy="true"] { cursor: progress; }
#panelApp.is-loading #main-content, .pnl-main[aria-busy="true"] #main-content { opacity: .78; transition: opacity .2s ease; }
.inline-check { display: flex; gap: 10px; align-items: center; }

/* Mobile table → card transform: opt-in only via .responsive-cards class
   (removed blanket override that broke all tables at 760px) */
@media (max-width: 640px) {
  table.responsive-cards thead { display: none; }
  table.responsive-cards,
  table.responsive-cards tbody,
  table.responsive-cards tr,
  table.responsive-cards td { display: block; width: 100%; }
  table.responsive-cards tr { border: 1px solid rgba(15,23,42,.08); border-radius: 16px; padding: 10px 12px; margin-bottom: 12px; background: #fff; }
  table.responsive-cards td { border: 0 !important; padding: 8px 0 !important; min-width: 0 !important; }
  table.responsive-cards td::before { content: attr(data-label); display: block; font-size: .76rem; font-weight: 700; color: var(--n500, #64748b); margin-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
