:root {
  --primary-color: #c70000;
  --primary-dark: #8f0000;
  --primary-light: #ffcccc;
  --bg-body: #f4f6f9;
  --text-main: #2c3e50;
  --text-muted: #7f8c8d;
  --radius-md: 12px;
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 10px 25px rgba(0,0,0,0.1);
  --input-border: #e1e4e8;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  width: 100%;
  max-width: 1200px;
  padding: 2rem;
}

.cards-wrapper {
  display: grid;
  grid-template-columns: 1fr 1.2fr; /* Give more space to form */
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .cards-wrapper {
    grid-template-columns: 1fr;
  }
  .container {
    padding: 1rem;
  }
}

/* CARD STYLES */
.card {
  background: white;
  padding: 2.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  opacity: 0;
  animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  position: relative;
  overflow: visible; /* Changed to visible to allow shadows/transforms to work nicely */
  transition: all 0.3s ease;
  border: 1px solid rgba(0,0,0,0.02);
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-5px);
}

.card.info-section {
  animation-delay: 0.1s;
}

.card.form-section {
  animation-delay: 0.3s;
}

/* Gradient Top Border */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--primary-color), #ff4d4d);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.info-section h3 {
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.info-section ul {
  list-style: none;
  padding: 0;
}

.info-section li {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.6;
  color: var(--text-main);
}

.info-section li::before {
  content: '•';
  color: var(--primary-color);
  font-weight: bold;
  position: absolute;
  left: 0;
  font-size: 1.2rem;
}

.btn-voltar {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  padding: 10px 25px;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 1rem;
  display: inline-block;
}

.btn-voltar:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(199, 0, 0, 0.2);
}

/* FORM SECTION */
.form-section h2 {
  color: var(--text-main);
  margin-bottom: 2rem;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
}

.p-form {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-main);
}

.input-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
  width: 100%;
}

.input-wrapper i {
  position: absolute;
  left: 18px;
  top: 26px; /* Fixed top position instead of 50% to prevent moving in multiline inputs */
  transform: translateY(-50%);
  color: var(--text-muted);
  z-index: 2;
  font-size: 1.1rem;
  transition: color 0.3s;
}

.input-wrapper:focus-within i {
  color: var(--primary-color);
}

.input-wrapper input,
.input-wrapper select {
  width: 100%;
  padding: 14px 14px 14px 50px; /* Increased padding to 50px */
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: all 0.3s;
  background: #fdfdfd;
  color: var(--text-main);
  height: auto;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
  border-color: var(--primary-color);
  background: white;
  box-shadow: 0 0 0 4px rgba(199, 0, 0, 0.1);
  outline: none;
}

/* Select2 Customization */
.select2-container {
  width: 100% !important;
}

.select2-container--default .select2-selection--single {
  height: 52px !important;
  padding: 10px !important;
  border: 1px solid var(--input-border) !important;
  border-radius: var(--radius-md) !important;
  display: flex !important;
  align-items: center !important;
  background-color: #fdfdfd !important;
  transition: all 0.3s;
}

.input-wrapper .select2-container--default .select2-selection--single {
  padding-left: 50px !important; /* Matches input padding */
}

.select2-container--default .select2-selection--single:focus,
.select2-container--open .select2-selection--single {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 4px rgba(199, 0, 0, 0.1) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 50px !important;
  top: 1px !important;
  right: 10px !important;
}

.select2-dropdown {
  border: 1px solid #e1e4e8 !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-hover) !important;
  z-index: 9999 !important;
  overflow: hidden;
}

.select2-results__option {
  padding: 12px 15px !important;
}

.select2-results__option--highlighted {
  background-color: var(--primary-color) !important;
  color: white !important;
}

/* BLOOD CHIPS */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1rem;
  justify-content: center;
}

.chip {
  flex: 1 0 70px; /* Bigger chips */
  max-width: 110px;
  height: 55px;
  padding: 0;
  border: 2px solid #eee;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
  z-index: 1;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.chip:hover {
  border-color: var(--primary-light);
  color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(199, 0, 0, 0.1);
}

.chip.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 8px 20px rgba(199, 0, 0, 0.3);
  animation: pulse-select 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Special styling for "Não sei meu tipo" */
.chip[data-value="DESCONHECIDO"] {
  flex-basis: 100%;
  max-width: 100%;
  margin-top: 5px;
  border-style: dashed;
  font-size: 0.95rem;
}

/* SUBMIT BUTTON */
#btn-submit {
  width: 100%;
  padding: 16px;
  background: linear-gradient(45deg, var(--primary-color), #d63031);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 1.5rem;
  box-shadow: 0 4px 15px rgba(199, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(199, 0, 0, 0.3);
  filter: brightness(1.1);
}

#btn-submit:active {
  transform: translateY(0);
}

/* ANIMATIONS */
@keyframes fadeInUp {
  from { opacity: 0; transform: translate3d(0, 30px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes pulse-select {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: translateY(-5px) scale(1.05); }
}

@media (max-width: 600px) {
  .card { padding: 1.5rem; }
  .input-wrapper input { padding-left: 45px; }
}

/* --- Horários Grid (NOVO - Fix para Agendamento Público) --- */
.horarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 0.5rem;
    width: 100%;
    min-height: 52px; /* Match input height */
    padding-left: 50px; /* Space for the icon */
    align-items: center; /* Center placeholder text vertically if needed */
}

.time-slot {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 5px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    color: #495057;
    position: relative;
    /* Reset padding for button content */
    margin: 0;
}

.time-slot:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.time-slot.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.time-slot.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e9ecef;
}

.time-slot small {
    display: block;
    font-size: 0.7rem;
    font-weight: normal;
    margin-top: 2px;
}

.placeholder-text {
    grid-column: 1 / -1;
    text-align: left; /* Align left to match inputs */
    color: #6c757d;
    font-style: italic;
    padding: 1rem 0; /* Vertical padding only */
}

.loading-text {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--primary-color);
    font-weight: 500;
    padding: 1rem;
}
