/* ==========================================================================
   AgendaPro SaaS - Sistema de Design Responsivo e Moderno
   Compatível com Hostinger e todos os navegadores modernos (Desktop e Mobile)
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #475569;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --dark: #0f172a;
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #ffffff;
  --radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  background-color: #f8fafc;
  color: var(--gray-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}
a:hover {
  color: var(--primary-hover);
}

/* Layout Geral */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.025em;
}

.sidebar-menu {
  list-style: none;
  padding: 16px 12px;
  flex-grow: 1;
}

.sidebar-menu li {
  margin-bottom: 4px;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #94a3b8;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.925rem;
  transition: all 0.2s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
  background: #1e293b;
  color: var(--white);
}

.sidebar-menu a.active {
  background: var(--primary);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #1e293b;
  font-size: 0.85rem;
  color: #64748b;
}

.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.topbar {
  background: var(--white);
  height: 64px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gray-900);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.content-body {
  padding: 24px;
  flex-grow: 1;
}

/* Cards & Containers */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-50);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
}

.card-body {
  padding: 20px;
}

/* Grid & Estatísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

.stat-desc {
  font-size: 0.825rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Formulários */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row > * {
  flex: 1;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--white);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-secondary:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.btn-success {
  background: var(--success);
  color: var(--white);
}
.btn-success:hover {
  background: #15803d;
  color: var(--white);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover {
  background: #b91c1c;
  color: var(--white);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.825rem;
}

.btn-block {
  width: 100%;
}

/* Tabelas Responsivas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background: var(--gray-50);
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.9rem;
  color: var(--gray-700);
}

.table tbody tr:hover {
  background: var(--gray-50);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Alertas & Flash Messages */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.925rem;
  border: 1px solid transparent;
}

.alert-success { background: var(--success-light); border-color: #bbf7d0; color: #166534; }
.alert-error { background: var(--danger-light); border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--warning-light); border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--primary-light); border-color: #bfdbfe; color: #1e40af; }

/* Grid de Horários / Chips de Slots */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.slot-chip {
  padding: 12px 10px;
  border: 2px solid var(--gray-200);
  background: var(--white);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.slot-chip:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.slot-chip.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
}

.slot-chip.disabled {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-400);
  cursor: not-allowed;
}

.slot-chip-time {
  font-size: 1.05rem;
  font-weight: 700;
}

.slot-chip-duration {
  font-size: 0.75rem;
  margin-top: 2px;
  opacity: 0.8;
}

/* Modais nativos via CSS/JS simples */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--white);
  border-radius: var(--radius);
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .content-body {
    padding: 16px;
  }
}
