@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

/* ==========================================================================
   GC PLAYER — tema alinhado ao GerenciaClientes
   Primária: sky (#0ea5e9 / #0284c7) · Neutros: slate · Fonte: Inter
   Light mode, cards brancos, sidebar branca, menu estilo pill azul.
   ========================================================================== */
:root {
  --bg: #f8fafc;          /* slate-50  */
  --bg-2: #f1f5f9;        /* slate-100 */
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --line: #e2e8f0;        /* slate-200 */
  --line-strong: #cbd5e1; /* slate-300 */
  --text: #1e293b;        /* slate-800 */
  --heading: #0f172a;     /* slate-900 */
  --muted: #64748b;       /* slate-500 */
  --accent: #0284c7;      /* primary-600 */
  --accent-2: #0ea5e9;    /* primary-500 */
  --accent-deep: #0369a1; /* primary-700 */
  --accent-soft: #e0f2fe; /* primary-100 */
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --pending: #d97706;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lift: 0 10px 25px -5px rgba(15, 23, 42, 0.12);
  --glow: 0 8px 20px rgba(2, 132, 199, 0.28);
  --topbar: rgba(255, 255, 255, 0.85);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ============================ DARK MODE (classe .dark no <html>) ============================ */
html.dark {
  --bg: #0f172a;          /* slate-900 */
  --bg-2: #1e293b;        /* slate-800 */
  --panel: #1e293b;       /* slate-800 (superfícies) */
  --panel-solid: #1e293b;
  --line: #334155;        /* slate-700 */
  --line-strong: #475569; /* slate-600 */
  --text: #e2e8f0;        /* slate-200 */
  --heading: #f8fafc;     /* slate-50  */
  --muted: #94a3b8;       /* slate-400 */
  --accent-soft: rgba(2, 132, 199, 0.18);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 12px 28px -6px rgba(0, 0, 0, 0.55);
  --topbar: rgba(15, 23, 42, 0.85);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-deep); }
code, .mono { font-family: ui-monospace, Consolas, monospace; color: var(--accent-deep); }

/* Scrollbar (estilo GerenciaClientes) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.app-shell { display: flex; min-height: 100vh; }

/* ============================ SIDEBAR ============================ */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1.1rem .85rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  gap: .8rem;
  align-items: center;
  padding: .3rem .4rem 1rem;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  background: linear-gradient(145deg, var(--accent-2), var(--accent-deep));
  color: #fff;
}
.brand strong { display: block; font-size: 1.05rem; letter-spacing: .01em; color: var(--heading); font-weight: 700; }
.brand small { color: var(--muted); font-size: .78rem; }

.sidebar nav { display: flex; flex-direction: column; gap: .18rem; flex: 1; overflow: auto; }
.sidebar nav a {
  color: var(--muted);
  padding: .62rem .85rem;
  border-radius: 10px;
  font-weight: 500;
  font-size: .92rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  transition: all .18s ease;
  border: 1px solid transparent;
}
.sidebar nav a:hover {
  background: var(--bg-2);
  color: var(--heading);
}
.sidebar nav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--glow);
}
.sidebar nav a.active:hover { background: var(--accent-deep); color: #fff; }
.sidebar nav a.nav-exit { margin-top: auto; color: var(--err); }
.sidebar nav a.nav-exit:hover { background: #fef2f2; color: #b91c1c; }
.sidebar-foot {
  padding: .7rem .5rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .74rem;
}

/* ============================ MAIN / TOPBAR ============================ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .95rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -.01em;
}
.menu-btn {
  display: none;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  width: 42px;
  height: 42px;
  cursor: pointer;
}
.page { padding: 1.4rem 1.5rem 2.6rem; }

/* ============================ CARDS ============================ */
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-2), transparent 75%);
}
.card h3 {
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.card strong {
  display: block;
  margin-top: .5rem;
  font-size: 1.85rem;
  color: var(--heading);
  font-weight: 800;
}
.card .hint { color: var(--muted); font-size: .85rem; margin-top: .4rem; }

/* ============================ PANEL ============================ */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.35rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--heading);
  font-weight: 700;
}
.panel p.lead { color: var(--muted); margin: -.35rem 0 1rem; }

/* ============================ FORMS ============================ */
.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .95rem 1.05rem;
}
.grid-form .full { grid-column: 1 / -1; }
.grid-form .actions { display: flex; gap: .65rem; align-items: end; flex-wrap: wrap; }

label {
  display: grid;
  gap: .38rem;
  color: var(--text);
  font-size: .86rem;
  font-weight: 500;
}
input, select, textarea, button, .btn {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  padding: .66rem .8rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}
textarea { resize: vertical; min-height: 90px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }

button, .btn {
  background: var(--accent);
  border: 1px solid transparent;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow);
  transition: transform .12s ease, background .12s ease;
}
button:hover, .btn:hover { background: var(--accent-deep); transform: translateY(-1px); }
button.secondary, .btn.secondary, button.ghost, .btn.ghost {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  color: var(--text);
  box-shadow: none;
}
button.secondary:hover, .btn.secondary:hover, button.ghost:hover, .btn.ghost:hover {
  background: var(--bg-2);
}
button.ok, .btn.ok { background: var(--ok); box-shadow: none; }
button.ok:hover, .btn.ok:hover { background: #15803d; }
button.danger, .btn.danger { background: var(--err); box-shadow: none; }
button.danger:hover, .btn.danger:hover { background: #b91c1c; }

.inline-form { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }
.inline-form input { min-width: 0; }
button.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}
button.link:hover { background: none; color: var(--accent-deep); transform: none; }
button.link.danger { color: var(--err); background: none; }

.inline { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
.inline input[type="search"] { flex: 1; min-width: 180px; }

/* ============================ TABLE ============================ */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td {
  text-align: left;
  padding: .8rem .8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--text);
}
th {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--bg-2);
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--bg); }
.row-actions { display: flex; gap: .65rem; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }

/* ============================ BADGES ============================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--bg-2);
  color: var(--muted);
}
.badge.active { background: #dcfce7; color: #15803d; }
.badge.pending { background: #fef3c7; color: #b45309; }
.badge.blocked, .badge.inactive { background: #fee2e2; color: #b91c1c; }

/* ============================ ALERTS ============================ */
.alert {
  padding: .85rem 1.05rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  color: var(--text);
}
.alert.ok { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert.error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* ============================ AUTH (LOGIN) ============================ */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background:
    radial-gradient(700px 400px at 20% 10%, rgba(14, 165, 233, 0.18), transparent 55%),
    radial-gradient(600px 380px at 90% 80%, rgba(2, 132, 199, 0.16), transparent 50%),
    linear-gradient(160deg, #eef6fc, #f8fafc);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.95rem 1.75rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  text-align: center;
}
.auth-card h1 { margin: 0 0 .3rem; color: var(--heading); font-size: 1.6rem; font-weight: 700; }
.auth-card .muted { color: var(--muted); margin: 0 0 1.25rem; }
.auth-card form { display: grid; gap: .95rem; text-align: left; }
.auth-card button { width: 100%; padding: .85rem; font-size: 1rem; }
.auth-badge {
  display: inline-flex;
  margin-bottom: 1rem;
  padding: .32rem .7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #bae6fd;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

/* ============================ MISC ============================ */
.info-box {
  background: var(--accent-soft);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: .95rem 1.1rem;
  color: #075985;
  margin-bottom: 1rem;
}
.info-box strong { color: var(--accent-deep); }
.info-box code { display: none; }

label.check {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-direction: row;
  padding-top: 1.6rem;
}
label.check input { width: auto; }

.section-title {
  margin: 0 0 .85rem;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.preview-logo, .preview-bg {
  max-width: 100%;
  max-height: 120px;
  border-radius: 12px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: var(--bg-2);
}
.rebrand-preview { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }

/* Logo GC PLAYER (marca da sidebar e telas de login) */
.brand-logo {
  background: #fff !important;
  padding: 3px;
  object-fit: contain;
  border: 1px solid var(--line);
  box-shadow: none;
}
.auth-logo {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  object-fit: contain;
  border-radius: 18px;
  background: #fff;
  padding: 6px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 20;
    transform: translateX(-105%);
    transition: transform .22s ease;
    height: 100vh;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lift); }
  .menu-btn { display: inline-grid; place-items: center; }
  .grid-form { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
}

/* Ícones do menu */
.sidebar nav a .nav-ic { flex-shrink: 0; opacity: .85; }
.sidebar nav a.active .nav-ic { opacity: 1; }
.sidebar nav a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================ DARK — ajustes finos por componente ============================ */
html.dark .card::before { background: linear-gradient(90deg, var(--accent-2), transparent 80%); opacity: .8; }
html.dark .th, html.dark th { background: #0f172a; }
html.dark tr:hover td { background: rgba(148, 163, 184, 0.06); }

html.dark .badge { background: #334155; color: #cbd5e1; }
html.dark .badge.active { background: rgba(34, 197, 94, 0.16); color: #86efac; }
html.dark .badge.pending { background: rgba(217, 119, 6, 0.20); color: #fcd34d; }
html.dark .badge.blocked, html.dark .badge.inactive { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }

html.dark .alert.ok { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.32); color: #86efac; }
html.dark .alert.error { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.32); color: #fca5a5; }

html.dark .info-box { background: rgba(2, 132, 199, 0.16); border-color: rgba(2, 132, 199, 0.35); color: #bae6fd; }
html.dark .info-box strong { color: #7dd3fc; }

html.dark .sidebar nav a.nav-exit:hover { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
html.dark .auth-badge { background: rgba(2, 132, 199, 0.22); border-color: rgba(2, 132, 199, 0.4); color: #7dd3fc; }
html.dark .preview-logo, html.dark .preview-bg { background: #0f172a; }

html.dark .auth-body {
  background:
    radial-gradient(700px 400px at 20% 10%, rgba(14, 165, 233, 0.14), transparent 55%),
    radial-gradient(600px 380px at 90% 80%, rgba(2, 132, 199, 0.16), transparent 50%),
    linear-gradient(160deg, #0b1220, #0f172a);
}
html.dark .auth-card { box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }

/* ============================ TOGGLE DE TEMA ============================ */
.theme-toggle {
  margin-left: auto;
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: none;
  transition: background .15s ease;
}
.theme-toggle:hover { background: var(--line); transform: none; color: var(--text); }
.theme-toggle svg { width: 19px; height: 19px; }
.auth-toggle { position: fixed; top: 1.1rem; right: 1.1rem; margin: 0; z-index: 10; }
html.dark .theme-toggle .ic-moon { display: none; }
html:not(.dark) .theme-toggle .ic-sun { display: none; }

/* menu-btn não deve herdar o hover azul de <button> */
.menu-btn:hover { background: var(--line); transform: none; }
