/* ============================================================
   CLONEI v2 — Design System
   ============================================================ */
:root {
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #eef2ff;
  --surface:       #ffffff;
  --bg:            #f8fafc;
  --bg2:           #f1f5f9;
  --border:        #e2e8f0;
  --border2:       #cbd5e1;
  --text:          #0f172a;
  --muted:         #64748b;
  --muted2:        #94a3b8;
  --success:       #22c55e;
  --success-bg:    #f0fdf4;
  --warning:       #f59e0b;
  --warning-bg:    #fffbeb;
  --danger:        #ef4444;
  --danger-bg:     #fef2f2;
  --info:          #3b82f6;
  --info-bg:       #eff6ff;
  --radius:        10px;
  --radius-lg:     16px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.03);
  --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

img { max-width: 100%; }

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-container {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex; align-items: center; gap: 20px;
}
.nav-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 1.1rem; font-weight: 700;
  color: var(--text); text-decoration: none;
  flex-shrink: 0;
}
.nav-brand:hover { text-decoration: none; }
.nav-links {
  display: flex; align-items: center; gap: 6px; flex: 1;
  margin-left: 12px;
}
.nav-links a {
  padding: 6px 12px; border-radius: 8px;
  color: var(--muted); font-weight: 500; font-size: .9rem;
  transition: background .15s, color .15s;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--bg2); color: var(--text);
  text-decoration: none;
}
.tag-admin {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
}
.nav-user {
  display: flex; align-items: center; gap: 12px;
  margin-left: auto;
}
.trial-badge {
  background: var(--warning-bg); color: #92400e;
  border: 1px solid #fcd34d;
  font-size: .78rem; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
.active-badge {
  background: var(--success-bg); color: #166534;
  border: 1px solid #86efac;
  font-size: .78rem; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
.nav-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}
.btn-link {
  color: var(--muted); font-size: .88rem;
  background: none; border: none; cursor: pointer;
  padding: 0;
}
.btn-link:hover { color: var(--text); text-decoration: none; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: .9rem; font-weight: 600; font-family: var(--font);
  border: 1.5px solid transparent;
  cursor: pointer; transition: all .15s;
  line-height: 1; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline {
  background: transparent; color: var(--text); border-color: var(--border2);
}
.btn-outline:hover { background: var(--bg2); border-color: var(--border2); }
.btn-danger {
  background: var(--danger-bg); color: var(--danger); border-color: #fca5a5;
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success {
  background: var(--success); color: #fff; border-color: var(--success);
}
.btn-success:hover { background: #16a34a; }
.btn-ghost {
  background: transparent; color: var(--muted); border-color: transparent;
}
.btn-ghost:hover { background: var(--bg2); color: var(--text); }
.btn-sm { padding: 6px 13px; font-size: .83rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ── Layout ──────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 560px; margin: 0 auto; padding: 0 24px; }
.section { padding: 36px 0 60px; flex: 1; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.card-header h2, .card-header h3 {
  font-size: 1rem; font-weight: 600; color: var(--text);
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: .87rem; font-weight: 600; color: var(--text);
}
.form-label span { color: var(--muted); font-weight: 400; }
.form-control {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .93rem; font-family: var(--font);
  background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-control::placeholder { color: var(--muted2); }
.form-hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ── Flash messages ──────────────────────────────────────── */
.flash {
  padding: 13px 20px; margin: 0;
  display: flex; align-items: center; gap: 10px;
  font-size: .91rem; font-weight: 500;
}
.flash span:first-child {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; flex-shrink: 0;
}
.flash-success { background: var(--success-bg); color: #166534; border-bottom: 1px solid #bbf7d0; }
.flash-success span:first-child { background: #22c55e; color: #fff; }
.flash-error   { background: var(--danger-bg);  color: #991b1b; border-bottom: 1px solid #fca5a5; }
.flash-error span:first-child { background: var(--danger); color: #fff; }
.flash-info    { background: var(--info-bg);    color: #1e40af; border-bottom: 1px solid #bfdbfe; }
.flash-info span:first-child { background: var(--info); color: #fff; }
.flash-warning { background: var(--warning-bg); color: #92400e; border-bottom: 1px solid #fcd34d; }
.flash-warning span:first-child { background: var(--warning); color: #fff; }

/* ── Tags / Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .76rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em;
}
.badge-trial   { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
.badge-active  { background: var(--success-bg); color: #166534; border: 1px solid #86efac; }
.badge-expired { background: var(--danger-bg); color: #991b1b; border: 1px solid #fca5a5; }
.badge-blocked { background: var(--bg2); color: var(--muted); border: 1px solid var(--border); }
.badge-admin   { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #c7d2fe; }
.badge-pub     { background: var(--success-bg); color: #166534; }
.badge-draft   { background: var(--bg2); color: var(--muted); }

/* ── Stats cards (admin/membros) ─────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: .82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1.2; margin-top: 6px; }
.stat-sub   { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* ── Page grid (membros) ─────────────────────────────────── */
.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.page-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s;
}
.page-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border2);
}
.page-card h3 {
  font-size: .97rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.page-card .src {
  font-size: .78rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.page-card .meta-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.page-card .actions {
  display: flex; gap: 8px; margin-top: auto;
}
.page-card .actions .btn { flex: 1; }
.page-pub-box {
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .8rem;
}
.page-pub-box .pub-url {
  word-break: break-all; color: #166534;
  font-weight: 500; margin-top: 4px;
}
.page-pub-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-md);
}
.auth-box h1 {
  font-size: 1.5rem; font-weight: 800;
  margin-bottom: 6px;
}
.auth-box .auth-sub {
  color: var(--muted); font-size: .9rem;
  margin-bottom: 28px;
}
.auth-footer {
  text-align: center; margin-top: 22px;
  font-size: .88rem; color: var(--muted);
}

/* ── Toolbar / Page header ────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 12px; flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.4rem; font-weight: 800;
}
.page-header p { color: var(--muted); font-size: .9rem; margin-top: 2px; }

/* ── Clone form (app.php) ────────────────────────────────── */
.clone-hero {
  max-width: 680px; margin: 0 auto 36px;
  text-align: center;
}
.clone-hero h1 {
  font-size: 2rem; font-weight: 900;
  line-height: 1.2; margin-bottom: 8px;
}
.clone-hero p { color: var(--muted); font-size: 1rem; }
.clone-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  max-width: 680px; margin: 0 auto;
}
.clone-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: var(--bg2); padding: 4px; border-radius: 10px;
}
.clone-tab {
  flex: 1; padding: 8px; text-align: center;
  border-radius: 8px; cursor: pointer;
  font-size: .88rem; font-weight: 600; color: var(--muted);
  transition: all .15s;
}
.clone-tab.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
}
.clone-tab-pane { display: none; }
.clone-tab-pane.active { display: block; }
.clone-url-row {
  display: flex; gap: 10px;
}
.clone-url-row .form-control { flex: 1; }
.clone-progress {
  display: none; text-align: center; padding: 24px 0;
}
.clone-spinner {
  width: 44px; height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: .88rem;
}
.data-table th {
  text-align: left; padding: 12px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--bg); }
.data-table .actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.table-empty {
  text-align: center; padding: 48px 20px;
  color: var(--muted);
}
.table-empty svg { opacity: .3; margin-bottom: 12px; }

/* ── Search / Filter bar ─────────────────────────────────── */
.filter-bar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 18px; flex-wrap: wrap;
}
.filter-bar .form-control { max-width: 300px; }
.filter-bar select.form-control { max-width: 180px; }

/* ── Admin layout ─────────────────────────────────────────── */
.admin-body { background: var(--bg); }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-brand {
  display: flex; align-items: center; gap: 8px;
  padding: 18px 16px 16px;
  font-weight: 800; font-size: .97rem;
  color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.admin-brand:hover { text-decoration: none; }
.admin-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--primary);
  background: var(--primary-light);
  padding: 2px 7px; border-radius: 4px;
  margin-left: auto;
}
.admin-nav {
  padding: 12px 10px; flex: 1;
  display: flex; flex-direction: column; gap: 2px;
}
.admin-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--muted); font-size: .89rem; font-weight: 500;
  text-decoration: none; transition: all .12s;
}
.admin-nav a svg { width: 17px; height: 17px; flex-shrink: 0; }
.admin-nav a:hover { background: var(--bg2); color: var(--text); }
.admin-nav a.active { background: var(--primary-light); color: var(--primary); }
.admin-nav .admin-back {
  margin-top: auto; color: var(--muted); border-top: 1px solid var(--border);
  margin: 12px -10px 0; padding: 9px 22px; border-radius: 0;
}
.admin-main {
  flex: 1; padding: 28px; overflow-x: hidden;
}
.admin-page-header {
  margin-bottom: 24px;
}
.admin-page-header h1 { font-size: 1.35rem; font-weight: 800; }
.admin-page-header p  { color: var(--muted); font-size: .9rem; margin-top: 2px; }

/* ── User info cell ──────────────────────────────────────── */
.user-cell { display: flex; flex-direction: column; gap: 2px; }
.user-cell .name { font-weight: 600; color: var(--text); }
.user-cell .email { font-size: .8rem; color: var(--muted); }

/* ── Trial countdown ─────────────────────────────────────── */
.trial-warn { color: var(--danger) !important; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 0;
}
.footer-container {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  font-size: .82rem; color: var(--muted);
}
.footer-container a { color: var(--muted); }
.footer-container a:hover { color: var(--text); }

/* ── Landing page ─────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff; text-align: center;
  padding: 80px 24px;
}
.hero h1 { font-size: 3rem; font-weight: 900; line-height: 1.1; margin-bottom: 16px; }
.hero p { font-size: 1.15rem; opacity: .9; max-width: 560px; margin: 0 auto 32px; }
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-white { background: #fff; color: var(--primary); border-color: #fff; }
.btn-white:hover { background: #f0f0ff; }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px; padding: 60px 0;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.feature-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 14px;
}
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.feature-card p { color: var(--muted); font-size: .88rem; line-height: 1.6; }

/* ── Expirado page ────────────────────────────────────────── */
.expired-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 60px 24px;
}
.expired-box {
  text-align: center; max-width: 460px;
}
.expired-icon {
  font-size: 3.5rem; margin-bottom: 20px;
}
.expired-box h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: 10px; }
.expired-box p  { color: var(--muted); margin-bottom: 24px; line-height: 1.6; }
.expired-btns   { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px); transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; color: var(--muted); padding: 4px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--bg2); }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 22px;
}

/* ── Alert boxes ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .88rem; display: flex; gap: 10px;
  border: 1px solid;
}
.alert-info    { background: var(--info-bg);    color: #1e40af; border-color: #bfdbfe; }
.alert-success { background: var(--success-bg); color: #166534; border-color: #bbf7d0; }
.alert-warning { background: var(--warning-bg); color: #92400e; border-color: #fcd34d; }
.alert-danger  { background: var(--danger-bg);  color: #991b1b; border-color: #fca5a5; }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted2); font-size: .83rem;
  margin: 18px 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Utility ─────────────────────────────────────────────── */
.text-muted  { color: var(--muted); }
.text-sm     { font-size: .85rem; }
.text-xs     { font-size: .78rem; }
.text-center { text-align: center; }
.mt-4  { margin-top: 4px; }  .mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.gap-8 { gap: 8px; }
.d-flex { display: flex; } .align-center { align-items: center; }
.flex-1 { flex: 1; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-main { padding: 16px; }
  .nav-links { display: none; }
  .hero h1 { font-size: 2rem; }
  .clone-url-row { flex-direction: column; }
  .page-grid { grid-template-columns: 1fr; }
  .data-table { font-size: .8rem; }
  .data-table th, .data-table td { padding: 10px 12px; }
}
