/* ===== VARIÁVEIS DE TEMA ===== */
:root {
  /* TEMA ESCURO (padrão) */
  --bg-primary: #0a0a0f;
  --bg-secondary: #0d1117;
  --bg-card: #161b22;
  --bg-header: #21262d;
  --bg-hover: #1c2128;
  --bg-input: #0d1117;
  --bg-modal: #161b22;
  --bg-sidebar: #0d1117;
  --bg-sidebar-hover: rgba(255,255,255,0.06);
  
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  
  --border-color: #30363d;
  --border-light: rgba(255,255,255,0.06);
  
  --shadow: rgba(0,0,0,0.3);
  --shadow-modal: rgba(0,0,0,0.5);
  
  --color-accent: #6366f1;
  --color-accent-hover: #818cf8;
  --color-success: #3fb950;
  --color-danger: #f85149;

  --sidebar-width: 260px;
}

/* ===== TEMA CLARO ===== */
[data-theme="light"] {
  --bg-primary: #f6f8fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-header: #f3f4f6;
  --bg-hover: #f0f2f5;
  --bg-input: #ffffff;
  --bg-modal: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-sidebar-hover: rgba(0,0,0,0.05);
  
  --text-primary: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #8b949e;
  
  --border-color: #d0d7de;
  --border-light: rgba(0,0,0,0.08);
  
  --shadow: rgba(0,0,0,0.08);
  --shadow-modal: rgba(0,0,0,0.15);
  
  --color-accent: #6366f1;
  --color-accent-hover: #4f46e5;
  --color-success: #2da44e;
  --color-danger: #cf222e;
}

/* ===== ESTILOS GERAIS ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: background 0.3s ease, color 0.3s ease;
}

.page {
  flex: 1;
  padding: 24px 28px 28px;
  min-height: 100vh;
  background: var(--bg-secondary);
  overflow-x: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-secondary);
  transition: background 0.3s ease;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  padding: 20px 20px;
  background: var(--bg-sidebar);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid var(--border-light);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.sidebar-brand .brand {
  font-size: 0.85rem;
  line-height: 1.25;
}

.sidebar-subtitle {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: color 0.3s ease;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 16px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.search-icon {
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.search-box input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.search-box input::placeholder {
  color: var(--text-secondary);
}

/* ===== SIDEBAR MENU ===== */
.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-section-label {
  color: var(--text-secondary);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 8px;
  padding: 0 6px;
  transition: color 0.3s ease;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-link.active,
.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-sidebar-hover);
}

.sidebar-link.active {
  border-left: 4px solid var(--color-accent);
}

.sidebar-icon {
  display: inline-flex;
  width: 20px;
  justify-content: center;
  font-size: 0.9rem;
}

/* ===== BARRA SUPERIOR (breadcrumb + conta do usuário) ===== */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -24px -28px 20px;
  padding: 16px 28px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 20;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.topbar-breadcrumb {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.topbar-breadcrumb-category {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.topbar-breadcrumb-category::after {
  content: '/';
  margin-left: 8px;
  color: var(--text-secondary);
  opacity: 0.5;
}

.topbar-breadcrumb-current {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-dropdown {
  position: relative;
}

.topbar-icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--bg-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.3s ease;
}

.topbar-icon-button:hover {
  border-color: var(--color-accent);
}

.topbar-account-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.3s ease;
}

.topbar-account-trigger:hover {
  border-color: var(--color-accent);
}

.topbar-account-avatar {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
}

.topbar-account-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}

.topbar-account-name {
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  transition: color 0.3s ease;
}

.topbar-account-role {
  color: var(--text-secondary);
  font-size: 0.7rem;
  transition: color 0.3s ease;
}

.topbar-account-chevron {
  color: var(--text-secondary);
  font-size: 0.7rem;
}

.topbar-account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 12px 32px var(--shadow-modal);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 30;
}

.topbar-account-menu-label {
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
}

.topbar-account-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.topbar-account-menu-item:hover {
  background: var(--bg-hover);
}

/* ===== LOGO DO STUDIO (fundo branco em selo arredondado) ===== */
.studio-logo-badge {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: #ffffff;
  flex-shrink: 0;
  overflow: hidden;
}

.login-brand .studio-logo-badge {
  width: 56px;
  height: 56px;
  border-radius: 12px;
}

.studio-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

/* ===== MARCA DÁLIA AGENDA (troca com o tema) ===== */
.sidebar-app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
  margin-top: auto;
}

.app-brand-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

.app-brand-logo-dark {
  filter: drop-shadow(0 0 0.5px #e4e2f0) drop-shadow(0 0 0.5px #e4e2f0);
}

.app-brand-logo-light {
  display: none;
  filter: drop-shadow(0 0 0.5px #9294ab) drop-shadow(0 0 0.5px #9294ab);
}

[data-theme="light"] .app-brand-logo-dark {
  display: none;
}

[data-theme="light"] .app-brand-logo-light {
  display: block;
}

.app-brand-name {
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

/* ===== TAB PAGES ===== */
.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}


/* ============================================================
   ESTILOS COMPARTILHADOS ENTRE ABAS
   (usados por mais de uma aba - ex: Agenda e Clientes.
   NÃO mover para agenda.css/clientes.css sem checar todas as abas
   que usam essas classes primeiro!)
   ============================================================ */

.hidden {
  display: none !important;
}

.clear-filters-button {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.clear-filters-button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--color-accent);
}

.clear-filters-button::before {
  content: "✕";
  font-size: 0.6rem;
}

.agenda-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 16px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.agenda-item:hover {
  background: var(--bg-hover);
}

.agenda-item.placeholder {
  text-align: center;
  color: var(--text-secondary);
  padding: 30px 20px;
  grid-column: 1 / -1;
  transition: color 0.3s ease;
}


/* ===== BOTÕES ===== */
.secondary-button {
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  background: var(--border-color);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.3s ease;
}

.secondary-button:hover {
  background: var(--text-muted);
}

.primary-button {
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  background: var(--color-accent);
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.primary-button:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

/* ===== MODAIS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.75);
  z-index: 50;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(540px, 95%);
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-modal);
  border-radius: 22px;
  padding: 22px 24px 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 24px 80px var(--shadow-modal);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.modal-header p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-form {
  display: grid;
  gap: 12px;
}

/* ===== CAMPO DE SENHA COM BOTÃO MOSTRAR/OCULTAR ===== */
.password-field {
  position: relative;
}

.password-field input {
  padding-right: 40px !important;
}

.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  font-size: 0.95rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.password-toggle-btn:hover {
  opacity: 1;
}

.modal-form label {
  display: grid;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: color 0.3s ease;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  font-size: 0.85rem;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.modal-form input::placeholder,
.modal-form textarea::placeholder {
  color: var(--text-secondary);
}

.modal-form textarea {
  min-height: 70px;
  resize: vertical;
}

.modal-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .modal-form-row {
    grid-template-columns: 1fr;
  }
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  transition: border-color 0.3s ease;
}

.modal-form select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ===== CAMPOS DE DATA ===== */
input[type="date"] {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  font-size: 0.85rem;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  min-height: 40px;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  background-color: var(--color-accent);
  padding: 4px;
  border-radius: 5px;
  cursor: pointer;
  filter: invert(1);
}

input[type="date"]::-webkit-datetime-edit {
  color: var(--text-primary);
}

input[type="date"]:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

input[type="date"]::-webkit-inner-spin-button {
  display: none;
}

input[type="date"]::-webkit-clear-button {
  display: none;
}

input[type="date"]:invalid {
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .page {
    padding: 16px;
  }

  .clear-filters-button {
    width: 100%;
    justify-content: center;
  }

  .modal-card {
    width: 95%;
    padding: 18px;
  }

  .primary-button {
    width: 100%;
  }

  .sidebar {
    padding: 14px;
  }
}
