/* ==========================================================================
   PIA | Centro de Atención Plenus
   WhatsApp Flows / WebViews & Bottom-Sheets Styling (Tema Blanco)
   ========================================================================== */

.flow-modals-container {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
}

.flow-modals-container.hidden {
  display: none !important;
}

/* Backdrop */
.flow-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 27, 33, 0.65);
  backdrop-filter: blur(4px);
  animation: fadeInBackdrop 0.25s ease forwards;
}

@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Flow Bottom-Sheet */
.flow-sheet {
  position: relative;
  width: 100%;
  max-height: 88%;
  background: #ffffff;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
}

.flow-sheet.slide-in-active {
  animation: slideUpFlow 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.flow-sheet.slide-out-active {
  animation: slideDownFlow 0.25s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes slideUpFlow {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideDownFlow {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

/* Header */
.flow-header {
  padding: 16px 20px;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e9edef;
}

.flow-header.medical-header {
  background: #f0fdf4;
  border-bottom-color: #bbf7d0;
}

.flow-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.flow-logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.medical-cross {
  font-size: 24px;
}

.flow-title-box {
  display: flex;
  flex-direction: column;
}

.flow-title {
  font-weight: 700;
  font-size: 15px;
  color: #111b21;
}

.flow-subtitle {
  font-size: 11px;
  color: #667781;
}

.flow-close-btn {
  background: #e9edef;
  border: none;
  color: #54656f;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.flow-close-btn:hover {
  background: #d1d7db;
  color: #111b21;
}

/* Body */
.flow-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: #ffffff;
}

.flow-intro-card {
  background: #f8fafc;
  border-radius: 14px;
  padding: 16px;
  border: 1px solid #e2e8f0;
}

.flow-security-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #008069;
  margin-bottom: 12px;
  font-weight: 600;
}

.flow-summary-title {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.flow-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
}

.item-desc {
  font-size: 12px;
  color: #64748b;
  margin-top: 1px;
}

.item-price {
  font-weight: 800;
  font-size: 15px;
  color: #0f172a;
}

.flow-total-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 14px 0 12px 0;
}

.flow-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.total-label {
  font-weight: 800;
  font-size: 13.5px;
  color: #475569;
  letter-spacing: 0.5px;
}

.total-amount {
  font-size: 22px;
  font-weight: 900;
  color: #008069;
}

/* Method Selector */
.flow-method-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
}

.method-card {
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px 14px;
  border: 1.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.method-card.selected {
  border-color: #008069;
  background: #f0fdf4;
}

.method-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #008069;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio-inner {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #008069;
}

.bank-tag {
  background: #0e2439;
  color: #ffd279;
  font-weight: 800;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #c6a052;
}

.method-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
}

.method-meta {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}

/* CTA Buttons */
.flow-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.flow-btn-primary {
  width: 100%;
  background: #008069;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  padding: 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 4px 12px rgba(0, 128, 105, 0.25);
}

.flow-btn-primary:hover {
  background: #00a884;
}

.flow-btn-primary:active {
  transform: scale(0.98);
}

.btn-medical {
  background: #10b981;
  color: #ffffff;
}

.flow-footnote {
  text-align: center;
  font-size: 11px;
  color: #64748b;
}

/* Processing Spinner */
.flow-processing-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.flow-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: #008069;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

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

.processing-title {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.processing-subtitle {
  font-size: 13px;
  color: #64748b;
}

/* Success View & Receipt */
.flow-success-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 0;
}

.success-icon-badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  font-size: 30px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

.success-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.success-subtitle {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 18px;
}

.receipt-card {
  width: 100%;
  background: #f8fafc;
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.r-label {
  color: #64748b;
}

.r-val {
  color: #0f172a;
  font-weight: 600;
}

/* Medical Authorization Card */
.medical-auth-card {
  background: #f8fafc;
  border-radius: 14px;
  padding: 16px;
  border: 1.5px solid #bbf7d0;
}

.med-student-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 14px;
}

.avatar-tag {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #005696;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stu-name {
  font-weight: 800;
  font-size: 15px;
  color: #0f172a;
}

.stu-grade {
  font-size: 12px;
  color: #64748b;
}

.med-details-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13.5px;
}

.med-row {
  display: flex;
  justify-content: space-between;
}

.m-lbl { color: #64748b; }
.m-val { font-weight: 700; color: #0f172a; }
.text-alert { color: #d97706; }
.text-highlight { color: #059669; }

.med-consent-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.consent-checkbox-label {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
  cursor: pointer;
}

/* In-App Call View */
.call-modal-view {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #0e2439 0%, #005696 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 40px 24px;
  z-index: 60;
  animation: fadeInBackdrop 0.3s ease;
}

.call-header-info {
  margin-top: 10px;
}

.call-shield {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 11.5px;
  padding: 5px 14px;
  border-radius: 20px;
  font-weight: 600;
}

.call-center-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.call-avatar-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.pulse-anim {
  animation: pulseRing 1.8s infinite;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
  70% { box-shadow: 0 0 0 24px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.call-avatar-inner {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.call-avatar-inner img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.call-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.call-status {
  font-size: 15px;
  color: #38bdf8;
  font-weight: 600;
  margin-bottom: 4px;
}

.call-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}

.call-controls-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.call-audio-wave {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 24px;
}

.call-audio-wave span {
  width: 4px;
  height: 100%;
  background: #38bdf8;
  border-radius: 2px;
  animation: wave 1s infinite ease-in-out;
}

.call-audio-wave span:nth-child(1) { animation-delay: 0.1s; }
.call-audio-wave span:nth-child(2) { animation-delay: 0.2s; }
.call-audio-wave span:nth-child(3) { animation-delay: 0.3s; }
.call-audio-wave span:nth-child(4) { animation-delay: 0.4s; }
.call-audio-wave span:nth-child(5) { animation-delay: 0.5s; }

@keyframes wave {
  0%, 100% { height: 6px; }
  50% { height: 24px; }
}

.call-hangup-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #ef4444;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.4);
  transition: transform 0.1s;
}

.call-hangup-btn:active {
  transform: scale(0.92);
}
