/* ============================================================
   Divertida — Admin (estilos do painel)
   Ficheiro único usado por: dashboard.php, profissionais.php,
   edit-slide.php, edit-profissional.php, login.php
   ============================================================ */

:root {
  --bg: #F6F7FB;
  --paper: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #334155;
  --mute: #64748B;
  --line: #E5E7EB;
  --line-2: #CBD5E1;
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-soft: #EFF4FF;
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --warn: #B45309;
  --warn-soft: #FEF3C7;
  --danger: #B91C1C;
  --danger-soft: #FEE2E2;
  --sidebar-w: 220px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.admin { min-height: 100vh; display: flex; }

a { color: inherit; }

/* ===== Sidebar ===== */
aside.side {
  width: var(--sidebar-w);
  flex: 0 0 auto;
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.brand .name { font-weight: 600; font-size: 14.5px; }
.brand .name small {
  display: block;
  font-weight: 400;
  color: var(--mute);
  font-size: 11.5px;
  margin-top: 1px;
}

.group { display: flex; flex-direction: column; gap: 1px; }
.group .lbl {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--mute);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  border: 1px solid transparent;
}
.nav-item .ico {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--mute); flex: 0 0 auto;
}
.nav-item .count {
  margin-left: auto;
  background: #F1F5F9;
  color: var(--ink-2);
  font-size: 11px; font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}
.nav-item:hover { background: #F8FAFC; color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); border-color: #DBEAFE; }
.nav-item.active .ico { color: var(--primary-dark); }
.nav-item.active .count { background: #fff; color: var(--primary-dark); }
.nav-item.disabled { color: var(--mute); cursor: not-allowed; }
.nav-item.disabled:hover { background: transparent; color: var(--mute); }
.nav-item.disabled .tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--mute);
  background: #F1F5F9;
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.side .footer-nav {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* ===== Main ===== */
main.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

header.bar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.bar .title { display: flex; flex-direction: column; gap: 1px; }
.bar .title h1 { margin: 0; font-size: 16px; font-weight: 600; }
.bar .title .crumb { font-size: 12px; color: var(--mute); }
.bar .search {
  margin-left: auto;
  flex: 0 1 360px;
  display: flex;
  align-items: center;
  gap: 7px;
  background: #F8FAFC;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
}
.bar .search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
  color: var(--ink);
  font-family: inherit;
}
.bar .search input::placeholder { color: var(--mute); }
.bar .user { display: flex; align-items: center; gap: 10px; }
.who { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.who .av {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #E0E7FF;
  color: #3730A3;
  font-weight: 600; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}

/* ===== Buttons ===== */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  padding: 7px 13px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: #F8FAFC; border-color: var(--line-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #1E293B; }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Content shell ===== */
.content {
  padding: 22px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ===== Flash ===== */
.flash {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.flash::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex: 0 0 auto;
}
.flash-success { background: var(--success-soft); color: #166534; border-color: #BBF7D0; }
.flash-success::before { background: var(--success); }
.flash-error { background: var(--danger-soft); color: #991B1B; border-color: #FECACA; }
.flash-error::before { background: var(--danger); }

/* ===== Card ===== */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.card .card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card .card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card .card-head .helper { font-size: 12.5px; color: var(--mute); }
.card .card-body { padding: 18px; }
.card + .card { margin-top: 18px; }

/* ===== Stats row ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex; flex-direction: column;
  gap: 4px;
}
.stat .k { font-size: 12px; color: var(--mute); font-weight: 500; }
.stat .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--mute); margin-left: 4px; }
.stat .d { font-size: 11.5px; color: var(--success); font-weight: 600; }
.stat .d.neutral { color: var(--mute); }
.stat .d.warn { color: var(--warn); }

/* ===== Form ===== */
.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  display: flex; align-items: center; gap: 6px;
}
.field label .req { color: var(--danger); font-size: 11px; }
.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="password"],
.field input[type="file"],
.field textarea,
.field select {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 8px 11px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input[type="file"] {
  padding: 6px 8px;
  background: #F8FAFC;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.field .hint { font-size: 11.5px; color: var(--mute); }
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  gap: 10px;
  flex-wrap: wrap;
}
.form-actions .left { font-size: 12px; color: var(--mute); }
.form-actions .right-group { display: flex; gap: 8px; }

/* ===== Toolbar / Filtros ===== */
.toolbar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter {
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
  border-radius: 6px;
  padding: 5px 9px;
  cursor: pointer;
  font-family: inherit;
}
.filter.on { background: var(--primary-soft); border-color: #BFDBFE; color: var(--primary-dark); }
.toolbar .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.toolbar .right .meta { font-size: 12px; color: var(--mute); }

/* ===== Table ===== */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data thead th {
  text-align: left;
  background: #F8FAFC;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: .04em;
}
table.data tbody tr { border-bottom: 1px solid var(--line); transition: background .12s; }
table.data tbody tr:hover { background: #F8FAFC; }
table.data tbody td { padding: 11px 14px; vertical-align: middle; }

.row-img {
  width: 46px; height: 34px;
  border-radius: 6px;
  background: #EEF2FF;
  color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  overflow: hidden;
}
.row-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-img.av { border-radius: 50%; width: 34px; height: 34px; }
.row-img.tone-a { background: #FEE2E2; color: #B91C1C; }
.row-img.tone-b { background: #DCFCE7; color: #166534; }
.row-img.tone-c { background: #FEF3C7; color: #92400E; }
.row-img.tone-d { background: #E0E7FF; color: #3730A3; }
.row-img.tone-e { background: #FCE7F3; color: #9D174D; }

.row-title { font-weight: 600; color: var(--ink); }
.row-sub { font-size: 12px; color: var(--mute); margin-top: 1px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge.live { background: var(--success-soft); color: #166534; }
.badge.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.badge.off { background: #F1F5F9; color: var(--mute); }
.badge.off::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--mute); }

td .ord { font-weight: 600; color: var(--ink-2); }
td .actions { display: flex; gap: 6px; justify-content: flex-end; }
td .actions form { margin: 0; padding: 0; display: inline-flex; }
td .btn.edit { background: var(--warn-soft); border-color: #FDE68A; color: #92400E; }
td .btn.edit:hover { background: #FDE68A; }
td .btn.del { background: var(--danger-soft); border-color: #FECACA; color: #991B1B; }
td .btn.del:hover { background: #FECACA; }

.table-foot {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--mute);
  border-top: 1px solid var(--line);
}
.empty-row td {
  padding: 28px 14px;
  text-align: center;
  color: var(--mute);
  font-size: 13.5px;
}

/* ===== Edit page (single column) ===== */
.page-narrow { max-width: 720px; }
.preview-img {
  width: 144px; height: 96px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
  display: block;
}
.preview-photo {
  width: 96px; height: 96px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: block;
}
.preview-photo-empty {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: #F1F5F9;
  border: 1px dashed var(--line-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mute);
  font-size: 12px;
}

/* ===== Login ===== */
body.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 0% 0%, rgba(37, 99, 235, .08), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(124, 58, 237, .07), transparent 40%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, .12);
}
.login-card .lc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.login-card .lc-brand .mark {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.login-card h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.login-card .lc-brand p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--mute);
}
.login-card .lc-form { display: flex; flex-direction: column; gap: 14px; }

/* ===== Responsive ===== */
@media (max-width: 780px) {
  body.admin { flex-direction: column; }
  aside.side {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { border: 0; padding: 0 8px 0 4px; flex: 0 0 auto; }
  .group { flex: 0 0 auto; flex-direction: row; gap: 4px; }
  .group .lbl { display: none; }
  .nav-item { padding: 7px 10px; white-space: nowrap; }
  .nav-item .count { display: none; }
  .side .footer-nav { margin: 0; border: 0; padding: 0; flex-direction: row; }
  .form { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  header.bar { padding: 10px 14px; flex-wrap: wrap; }
  .bar .search { order: 3; flex-basis: 100%; margin-left: 0; }
  .content { padding: 16px; }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  table.data thead { display: none; }
  table.data tbody td { display: block; border: 0; padding: 6px 14px; }
  table.data tbody tr { display: block; padding: 12px 0; }
  td .actions { justify-content: flex-start; }
}
