/* ============================================================
   CEC Planner - Dr. Bruno Rocha
   Conversão fiel do Tailwind CSS para CSS Vanilla
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #F8F9FA;
  color: #2D3436;
  min-height: 100vh;
  padding-bottom: 5rem;
}

/* --- Header --- */
#app-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.header-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: #2563eb;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.header-icon svg {
  width: 24px;
  height: 24px;
}

.header-title {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.5;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-outline {
  background: #fff;
  color: #374151;
  border-color: #e5e7eb;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-outline:hover {
  background: #f9fafb;
}

.btn-outline:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-process {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 1rem;
  font-weight: 700;
  font-size: 1.125rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-process svg {
  width: 24px;
  height: 24px;
}

.btn-process:hover {
  background: #1d4ed8;
}

.btn-icon-danger {
  padding: 0.5rem;
  color: #ef4444;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
}

.btn-icon-danger svg {
  width: 20px;
  height: 20px;
}

.btn-icon-danger:hover {
  background: #fef2f2;
}

/* --- Main Container --- */
.main-container {
  max-width: 80rem;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* --- Input Section --- */
.input-section {
  max-width: 48rem;
  margin: 0 auto;
  animation: fadeInUp 0.3s ease forwards;
}

.input-card {
  background: #fff;
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.07);
  border: 1px solid #f3f4f6;
}

.input-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.input-card-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.input-card-desc {
  color: #4b5563;
  margin-bottom: 1.5rem;
  line-height: 1.625;
}

.input-textarea {
  width: 100%;
  height: 16rem;
  padding: 1.25rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  outline: none;
  transition: all 0.15s ease;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875rem;
  line-height: 1.625;
  resize: vertical;
}

.input-textarea:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px #3b82f6;
}

/* --- Error Message --- */
.error-msg {
  margin-top: 1rem;
  padding: 1rem;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 500;
}

/* --- Patients Grid --- */
.patients-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 1rem;
}

@media (min-width: 1024px) {
  .patients-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Patient Card --- */
.patient-card {
  border-radius: 1.5rem;
  border: 2px solid;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeInUp 0.3s ease forwards;
  opacity: 0;
}

/* Card color variants */
.card-blue    { border-color: #bfdbfe; background: rgba(239,246,255,0.3); }
.card-emerald { border-color: #a7f3d0; background: rgba(236,253,245,0.3); }
.card-violet  { border-color: #ddd6fe; background: rgba(245,243,255,0.3); }
.card-amber   { border-color: #fde68a; background: rgba(255,251,235,0.3); }
.card-rose    { border-color: #fecdd3; background: rgba(255,241,242,0.3); }
.card-indigo  { border-color: #c7d2fe; background: rgba(238,242,255,0.3); }
.card-cyan    { border-color: #a5f3fc; background: rgba(236,254,255,0.3); }
.card-orange  { border-color: #fed7aa; background: rgba(255,247,237,0.3); }
.card-teal    { border-color: #99f6e4; background: rgba(240,253,250,0.3); }
.card-fuchsia { border-color: #f0abfc; background: rgba(253,244,255,0.3); }

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-header-left {
  flex: 1;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.125rem 0.5rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.25rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

.meta-item {
  font-size: 0.75rem;
  font-weight: 500;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.meta-item svg {
  width: 12px;
  height: 12px;
}

.patient-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.patient-name svg {
  width: 20px;
  height: 20px;
  color: #9ca3af;
}

.patient-prontuario {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.card-header-right {
  text-align: right;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
}

.weight-display {
  font-size: 1.5rem;
  font-weight: 900;
  color: #2563eb;
}

.weight-display small {
  font-size: 0.875rem;
  font-weight: 700;
}

.height-display {
  font-size: 0.875rem;
  font-weight: 700;
  color: #6b7280;
}

.bsa-badge {
  padding: 0.125rem 0.5rem;
  background: #d1fae5;
  color: #047857;
  border-radius: 0.25rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.bsa-value {
  font-size: 0.75rem;
  font-weight: 700;
  color: #059669;
}

.age-display {
  font-size: 10px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Info Boxes */
.info-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .info-row {
    grid-template-columns: 1fr 1fr;
  }
}

.info-box {
  background: rgba(255,255,255,0.6);
  border-radius: 1rem;
  padding: 1rem;
  border: 1px solid rgba(255,255,255,0.4);
}

.info-box-label {
  font-size: 10px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.info-box-value {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.625;
}

/* CEC Parameters */
.cec-panel {
  background: #fff;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid #f3f4f6;
}

.cec-panel-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cec-panel-title svg {
  width: 16px;
  height: 16px;
}

.cec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
}

@media (min-width: 768px) {
  .cec-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.param-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.param-label {
  font-size: 9px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.param-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1f2937;
}

/* Toggle & Inputs */
.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  transition: all 0.15s ease;
  border: 1px solid;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.toggle-btn svg {
  width: 14px;
  height: 14px;
}

.toggle-btn.active {
  background: #10b981;
  color: #fff;
  border-color: #059669;
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}

.toggle-btn.inactive {
  background: #fff;
  color: #4b5563;
  border-color: #e5e7eb;
}

.toggle-btn.inactive:hover {
  background: #f9fafb;
}

.toggle-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: inline-block;
}

.inputs-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .inputs-row {
    grid-template-columns: 1fr 1fr;
  }
}

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

.input-label {
  font-size: 10px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-left: 0.25rem;
}

.input-field {
  width: 100%;
  padding: 0.5rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.15s ease;
  font-family: inherit;
}

.input-field:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px #3b82f6;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #d1d5db;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Utility --- */
.text-blue-600 { color: #2563eb; }
