:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #132238;
  --muted: #617189;
  --line: #dbe3ef;
  --primary: #285cff;
  --primary-dark: #1639a6;
  --selected: #e8efff;
  --success: #0f9f6e;
  --danger: #cc2f4a;
  --shadow: 0 20px 45px rgba(20, 40, 80, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: linear-gradient(180deg, #f5f7fb 0%, #edf2ff 100%);
  color: var(--text);
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.hero {
  margin-bottom: 28px;
}

.badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eaf0ff;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 600;
}

.hero h1 {
  margin: 14px 0 8px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
}

.hero p,
.section-head p,
.status {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(219, 227, 239, 0.8);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.section-head {
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.slots {
  display: grid;
  gap: 12px;
}

.slot {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  border-radius: 18px;
  padding: 16px 18px;
  cursor: pointer;
  transition: 0.18s ease;
  color: var(--text);
}

.slot:hover {
  border-color: var(--primary);
  box-shadow: 0 14px 30px rgba(40, 92, 255, 0.12);
  transform: translateY(-1px);
}

.slot.selected {
  border-color: var(--primary);
  background: var(--selected);
  box-shadow: 0 16px 34px rgba(40, 92, 255, 0.16);
}

.slot-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.slot-calendar {
  flex: 0 0 76px;
  display: grid;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid #cfdcff;
  background: #fff;
  box-shadow: inset 0 -1px 0 rgba(40, 92, 255, 0.05);
}

.slot-calendar-day {
  padding: 6px 8px;
  background: linear-gradient(180deg, #285cff 0%, #1d4ce0 100%);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

.slot-calendar-date {
  padding: 11px 8px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
}

.slot-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.slot-title {
  color: #10233d;
  font-size: 1rem;
}

.slot-time {
  color: #314661;
  font-size: 0.95rem;
  font-weight: 600;
}

.slot-status {
  display: block;
  margin-top: 10px;
  color: #41506b;
  font-size: 0.87rem;
  font-weight: 600;
}

.slot.selected .slot-calendar {
  border-color: rgba(22, 57, 166, 0.18);
}

.slot.selected .slot-title,
.slot.selected .slot-time,
.slot.selected .slot-status {
  color: #10233d;
}

.slot.selected .slot-status {
  color: var(--primary-dark);
}

.slot.selected .slot-calendar-day {
  background: linear-gradient(180deg, #1639a6 0%, #102a80 100%);
}

.slot.selected .slot-calendar-date {
  color: var(--primary-dark);
}

.slot:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(40, 92, 255, 0.14);
}

.slot:focus-visible .slot-calendar {
  border-color: rgba(40, 92, 255, 0.4);
}

.slot small {
  display: block;
}

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 500;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--text);
  background: #fff;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(40, 92, 255, 0.12);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 15px 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status.success {
  color: var(--success);
}

.status.error {
  color: var(--danger);
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
}

/* Calendar Layout Card */
.calendar-card {
  max-width: 100%;
}

.calendar-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
}

.calendar-view {
  display: flex;
  flex-direction: column;
}

.time-view {
  border-left: 1px solid var(--line);
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  min-height: 380px;
}

/* Calendar Widget */
.calendar-widget {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.calendar-month-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}

.calendar-btn {
  background: #f0f4fc;
  border: none;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-btn:hover {
  background: var(--selected);
  color: var(--primary);
  transform: scale(1.05);
}

.calendar-btn:active {
  transform: scale(0.95);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Calendar Day styling */
.calendar-day {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0; /* Previne que paddings default de botões forcem o grid a expandir */
  aspect-ratio: 1;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  border-radius: 50%;
  cursor: default;
  user-select: none;
  transition: all 0.2s ease;
  position: relative;
  outline: none;
}

.calendar-day.empty {
  pointer-events: none;
  visibility: hidden;
}

.calendar-day.disabled {
  color: var(--muted);
  opacity: 0.35;
  pointer-events: none;
}

.calendar-day.available {
  background: #f0f5ff;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}

.calendar-day.available:hover {
  background: var(--selected);
  transform: scale(1.08);
}

.calendar-day.available:focus-visible {
  box-shadow: 0 0 0 3px rgba(40, 92, 255, 0.25);
}

.calendar-day.selected {
  background: var(--primary) !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(40, 92, 255, 0.28);
}

.calendar-day.selected:hover {
  transform: scale(1.05);
}

/* Today dot indicator */
.calendar-day.today::after {
  content: '';
  position: absolute;
  bottom: 6px;
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
}

/* Time slots list */
.time-view .slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 6px;
}

/* Scrollbar styling for a premium look */
.time-view .slots::-webkit-scrollbar {
  width: 6px;
}

.time-view .slots::-webkit-scrollbar-track {
  background: transparent;
}

.time-view .slots::-webkit-scrollbar-thumb {
  background-color: var(--line);
  border-radius: 10px;
}

.select-date-message {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  border: 1px dashed var(--line);
  border-radius: 16px;
  margin-top: 10px;
}

/* Time slot pills */
.time-pill {
  width: 100%;
  border: 1px solid var(--primary);
  background: #ffffff;
  color: var(--primary);
  padding: 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  box-shadow: 0 2px 4px rgba(40, 92, 255, 0.02);
}

.time-pill:hover {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(40, 92, 255, 0.15);
  transform: translateY(-1px);
}

.time-pill.selected {
  background: var(--primary-dark);
  color: #ffffff;
  border-color: var(--primary-dark);
  box-shadow: 0 8px 18px rgba(22, 57, 166, 0.2);
}

.time-pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(40, 92, 255, 0.3);
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .page {
    width: min(100% - 16px, 1120px);
    padding: 24px 0 60px;
  }

  .card {
    padding: 20px;
    border-radius: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .calendar-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .time-view {
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 20px;
    min-height: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Exibir horários em 2 colunas no mobile para economizar altura */
  .time-view .slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .select-date-message {
    grid-column: span 2;
    padding: 30px 16px;
    font-size: 0.9rem;
  }

  .form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  button[type="submit"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 16px;
    border-radius: 18px;
  }

  .calendar-header {
    padding: 0;
  }

  .calendar-month-title {
    font-size: 1rem;
  }

  .calendar-weekdays {
    font-size: 0.65rem;
  }

  .calendar-days {
    gap: 4px;
  }

  .calendar-day {
    font-size: 0.88rem;
  }

  .time-view .slots {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .time-pill {
    padding: 12px 8px;
    font-size: 0.88rem;
    border-radius: 10px;
  }

  input,
  textarea {
    padding: 12px 14px;
    border-radius: 12px;
  }

  button[type="submit"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    border-radius: 12px;
  }
}
