/* ============================= */
/* ====== Atestados App ====== */
/* ============================= */

/* Title and Intro */
.atestados-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -.5px;
  margin: 0 0 .5rem;
  font-weight: 600;
}

.atestados-intro {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: .9rem;
  color: #6b7280;
  max-width: 62ch;
}

body.dark-mode .atestados-intro {
  color: #b4b4b4;
}

/* Page Container - fills the expanded content */
.atestados-page main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Step Sections - no card wrapper */
.atestados-step {
  margin-bottom: 0.25rem;
}

.atestados-step-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.atestados-step-label .step-number {
  color: #0071e3;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 1rem;
}

body.dark-mode .atestados-step-label .step-number {
  color: #01e6cd;
}

body.dark-mode .atestados-step-label {
  color: #9ca3af;
}

/* Type Selection Buttons */
.atestados-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.atestados-type-btn {
  background: #f5f5f7;
  border: 2px solid transparent;
  border-radius: 0.625rem;
  padding: 0.875rem 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  font-family: inherit;
}

.atestados-type-btn .material-symbols-outlined {
  font-size: 1.75rem;
  color: #0071e3;
}

body.dark-mode .atestados-type-btn .material-symbols-outlined {
  color: #01e6cd;
}

.atestados-type-btn span:last-child {
  font-size: 0.8rem;
  font-weight: 500;
  color: #1d1d1f;
}

body.dark-mode .atestados-type-btn {
  background: #3a3a3a;
}

body.dark-mode .atestados-type-btn span:last-child {
  color: #e2e2e2;
}

.atestados-type-btn:hover {
  background: rgba(0, 113, 227, 0.1);
  border-color: rgba(0, 113, 227, 0.3);
}

body.dark-mode .atestados-type-btn:hover {
  background: rgba(1, 230, 205, 0.1);
  border-color: rgba(1, 230, 205, 0.3);
}

.atestados-type-btn.active {
  background: rgba(0, 113, 227, 0.15);
  border-color: #0071e3;
}

body.dark-mode .atestados-type-btn.active {
  background: rgba(1, 230, 205, 0.15);
  border-color: #01e6cd;
}

/* Days Selection */
.atestados-days-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.atestados-day-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1d1d1f;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

body.dark-mode .atestados-day-btn {
  border-color: #4a4a4a;
  background: #3a3a3a;
  color: #e2e2e2;
}

.atestados-day-btn:hover {
  border-color: #0071e3;
  background: rgba(0, 113, 227, 0.1);
}

body.dark-mode .atestados-day-btn:hover {
  border-color: #01e6cd;
  background: rgba(1, 230, 205, 0.1);
}

.atestados-day-btn.active {
  background: #0071e3;
  border-color: #0071e3;
  color: #fff;
}

body.dark-mode .atestados-day-btn.active {
  background: #01e6cd;
  border-color: #01e6cd;
  color: #1e1e1e;
}

.atestados-day-btn.custom {
  width: 2.5rem;
  font-size: 1.1rem;
}

/* Custom Days Input */
.atestados-custom-days {
  display: none;
  margin-top: 0.75rem;
}

.atestados-custom-days.visible {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Stepper Container */
.atestados-stepper {
  display: flex;
  align-items: center;
  background: #f5f5f7;
  border-radius: 0.625rem;
  padding: 0.25rem;
  gap: 0;
}

body.dark-mode .atestados-stepper {
  background: #3a3a3a;
}

/* Stepper Buttons */
.atestados-stepper-btn {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  color: #0071e3;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  font-family: inherit;
}

.atestados-stepper-btn:hover {
  background: rgba(0, 113, 227, 0.1);
}

.atestados-stepper-btn:active {
  background: rgba(0, 113, 227, 0.2);
  transform: scale(0.95);
}

.atestados-stepper-btn .material-icons {
  font-size: 1.25rem;
}

body.dark-mode .atestados-stepper-btn {
  color: #01e6cd;
}

body.dark-mode .atestados-stepper-btn:hover {
  background: rgba(1, 230, 205, 0.1);
}

body.dark-mode .atestados-stepper-btn:active {
  background: rgba(1, 230, 205, 0.2);
}

/* Stepper Input */
.atestados-stepper input {
  width: 3rem;
  padding: 0.4rem 0.25rem;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  font-family: inherit;
  color: #1d1d1f;
  -moz-appearance: textfield;
}

.atestados-stepper input::-webkit-outer-spin-button,
.atestados-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.atestados-stepper input:focus {
  outline: none;
}

body.dark-mode .atestados-stepper input {
  color: #e2e2e2;
}

/* Stepper Label */
.atestados-stepper-label {
  font-size: 0.9rem;
  color: #6b7280;
  font-weight: 500;
}

body.dark-mode .atestados-stepper-label {
  color: #9ca3af;
}

/* Period Selection */
.atestados-period-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.atestados-period-btn {
  padding: 0.625rem;
  border-radius: 0.4rem;
  border: 2px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1d1d1f;
  transition: all 0.2s ease;
  text-align: center;
  font-family: inherit;
}

body.dark-mode .atestados-period-btn {
  border-color: #4a4a4a;
  background: #3a3a3a;
  color: #e2e2e2;
}

.atestados-period-btn:hover {
  border-color: #0071e3;
  background: rgba(0, 113, 227, 0.1);
}

body.dark-mode .atestados-period-btn:hover {
  border-color: #01e6cd;
  background: rgba(1, 230, 205, 0.1);
}

.atestados-period-btn.active {
  background: #0071e3;
  border-color: #0071e3;
  color: #fff;
}

body.dark-mode .atestados-period-btn.active {
  background: #01e6cd;
  border-color: #01e6cd;
  color: #1e1e1e;
}

/* Duration Selection (Declaração) */
.atestados-duration-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.custom-duration-btn {
  grid-column: 5;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  line-height: 1.2;
}

.custom-duration-btn .material-icons {
  font-size: 1.2rem;
}

.atestados-custom-duration {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  background: #f5f5f7;
  padding: 0.5rem;
  border-radius: 0.4rem;
}

body.dark-mode .atestados-custom-duration {
  background: #2a2a2a;
}

.atestados-custom-duration label {
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
}

body.dark-mode .atestados-custom-duration label {
  color: #9ca3af;
}

.atestados-custom-duration input {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.3rem;
  font-size: 0.9rem;
}

body.dark-mode .atestados-custom-duration input {
  border-color: #4a4a4a;
  background: #3a3a3a;
  color: #e2e2e2;
}

.atestados-duration-btn {
  padding: 0.625rem 0.4rem;
  border-radius: 0.4rem;
  border: 2px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1d1d1f;
  transition: all 0.2s ease;
  text-align: center;
  font-family: inherit;
}

body.dark-mode .atestados-duration-btn {
  border-color: #4a4a4a;
  background: #3a3a3a;
  color: #e2e2e2;
}

.atestados-duration-btn:hover {
  border-color: #0071e3;
}

body.dark-mode .atestados-duration-btn:hover {
  border-color: #01e6cd;
}

.atestados-duration-btn.active {
  background: #0071e3;
  border-color: #0071e3;
  color: #fff;
}

body.dark-mode .atestados-duration-btn.active {
  background: #01e6cd;
  border-color: #01e6cd;
  color: #1e1e1e;
}

/* Motivo Selection */
.atestados-motivo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

@media (min-width: 480px) {
  .atestados-motivo-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.atestados-motivo-btn {
  padding: 0.625rem;
  border-radius: 0.4rem;
  border: 2px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  color: #1d1d1f;
  transition: all 0.2s ease;
  text-align: center;
  font-family: inherit;
}

body.dark-mode .atestados-motivo-btn {
  border-color: #4a4a4a;
  background: #3a3a3a;
  color: #e2e2e2;
}

.atestados-motivo-btn:hover {
  border-color: #0071e3;
}

body.dark-mode .atestados-motivo-btn:hover {
  border-color: #01e6cd;
}

.atestados-motivo-btn.active {
  background: #0071e3;
  border-color: #0071e3;
  color: #fff;
}

body.dark-mode .atestados-motivo-btn.active {
  background: #01e6cd;
  border-color: #01e6cd;
  color: #1e1e1e;
}

/* Config Toggle Section */
.atestados-config-section {
  margin-top: 0.5rem;
}

.atestados-config-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
  padding: 0.5rem 0;
}

body.dark-mode .atestados-config-toggle {
  color: #9ca3af;
}

.atestados-config-toggle .material-icons {
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.atestados-config-toggle.expanded .material-icons {
  transform: rotate(180deg);
}

.atestados-config-options {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 0;
}

.atestados-config-options.visible {
  display: flex;
}

.atestados-config-chip {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  border-radius: 1rem;
  background: #f5f5f7;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  color: #4b5563;
  transition: all 0.2s ease;
  font-family: inherit;
}

body.dark-mode .atestados-config-chip {
  background: #3a3a3a;
  border-color: #4a4a4a;
  color: #9ca3af;
}

.atestados-config-chip:hover {
  border-color: #0071e3;
}

body.dark-mode .atestados-config-chip:hover {
  border-color: #01e6cd;
}

.atestados-config-chip.active {
  background: rgba(0, 113, 227, 0.15);
  border-color: #0071e3;
  color: #0071e3;
}

body.dark-mode .atestados-config-chip.active {
  background: rgba(1, 230, 205, 0.15);
  border-color: #01e6cd;
  color: #01e6cd;
}

.atestados-config-chip .material-icons {
  font-size: 0.875rem;
}

/* Patient/Doctor Fields */
.atestados-fields-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .atestados-fields-row {
    grid-template-columns: 1fr 1fr;
  }
}

.atestados-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.atestados-input-group.full-width {
  grid-column: 1 / -1;
}

.atestados-input-group label {
  font-size: 0.7rem;
  color: #6b7280;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

body.dark-mode .atestados-input-group label {
  color: #9ca3af;
}

.atestados-input-group input {
  padding: 0.5rem 0.625rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

body.dark-mode .atestados-input-group input {
  border-color: #4a4a4a;
  background: #2a2a2a;
  color: #e2e2e2;
}

.atestados-input-group input:focus {
  outline: none;
  border-color: #0071e3;
}

body.dark-mode .atestados-input-group input:focus {
  border-color: #01e6cd;
}

.atestados-input-group input::placeholder {
  color: #9ca3af;
}

/* Result Area */
.atestados-result {
  margin-top: 0.5rem;
  display: none;
}

.atestados-result.visible {
  display: block;
}

/* Copy Box - similar to anamneses copy-box */
.atestados-copy-box {
  position: relative;
  background-color: #f5f5f7;
  padding: 1rem 2.5rem 1rem 1rem;
  border-radius: 0.75rem;
  overflow-wrap: break-word;
  min-height: 100px;
  user-select: text;
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.dark-mode .atestados-copy-box {
  background-color: #212121;
  border: none;
}

/* Button Container - positioned on the right */
.atestados-button-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

/* Copy Mode Toggle Button */
.atestados-copy-mode-toggle {
  background: none;
  border: none;
  color: #939393;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease, transform 0.3s ease;
  border-radius: 50%;
}

.atestados-copy-mode-toggle:hover {
  color: #01e6cd;
  transform: scale(1.1);
}

.atestados-copy-mode-toggle.active {
  color: #0071e3;
}

body.dark-mode .atestados-copy-mode-toggle.active {
  color: #01e6cd;
}

.atestados-copy-mode-toggle .material-icons {
  font-size: 1.3rem;
}

/* Copy Button */
.atestados-copy-btn {
  background: none;
  border: none;
  color: #939393;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease, transform 0.3s ease;
  border-radius: 50%;
}

.atestados-copy-btn:hover {
  color: #01e6cd;
  transform: scale(1.1);
}

.atestados-copy-btn:active {
  transform: scale(1);
}

.atestados-copy-btn .material-icons {
  font-size: 1.3rem;
}

/* Result Text */
.atestados-result-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #1d1d1f;
  white-space: pre-wrap;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  touch-action: manipulation;
}

body.dark-mode .atestados-result-text {
  color: #ffffffc9;
}

/* Manual copy mode - allow text selection */
.atestados-copy-box.manual-copy-enabled .atestados-result-text {
  user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  cursor: text;
}

/* Hidden Steps */
.atestados-step.hidden,
.atestados-subselection.hidden,
.hidden {
  display: none;
}

/* Divider */
.atestados-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.5rem 0;
}

body.dark-mode .atestados-divider {
  background: #3a3a3a;
}

/* Responsive */
@media (max-width: 380px) {
  .atestados-type-grid {
    grid-template-columns: 1fr;
  }
  
  .atestados-period-grid {
    grid-template-columns: 1fr;
  }
  
  .atestados-duration-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .atestados-day-btn {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.85rem;
  }
}
