:root {
  --bg-dark: #05112d;
  --card-bg: rgba(15, 23, 42, 0.85);
  --card-border: rgba(255, 255, 255, 0.12);
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --brand-blue: #0f62fe;
  --brand-cyan: #47c5f3;
  --brand-glow: rgba(15, 98, 254, 0.4);
  --accent-green: #25D366;
  --accent-gold: #fbbf24;
  --input-bg: rgba(10, 20, 45, 0.7);
  --input-border: rgba(255, 255, 255, 0.15);
  --input-focus: #0f62fe;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(15, 98, 254, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(71, 197, 243, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(5, 17, 45, 0.8) 0%, #05112d 100%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header-nav {
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 17, 45, 0.6);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo-img {
  height: 40px;
  width: auto;
}

/* Co-branding con Advanced Bionics */
.brand-divider {
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  color: rgba(255, 255, 255, 0.45);
  margin: 0 16px;
}

.brand-partner-box {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 10px;
  padding: 8px 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.brand-partner-img {
  display: block;
  height: 28px;
  width: auto;
}

@media (max-width: 480px) {
  .brand-divider {
    margin: 0 10px;
  }

  .brand-partner-box {
    padding: 6px 10px;
  }

  .brand-partner-img {
    height: 22px;
  }

  .brand-logo-img {
    height: 30px;
  }
}

.back-home-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.back-home-link:hover {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.main-container {
  max-width: 900px;
  width: 100%;
  margin: 40px auto 60px;
  padding: 0 20px;
  flex: 1;
}

.page-header {
  text-align: center;
  margin-bottom: 40px;
}

.page-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: rgba(15, 98, 254, 0.15);
  border: 1px solid rgba(71, 197, 243, 0.3);
  border-radius: 20px;
  color: var(--brand-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.page-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, #b0c4de 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 680px;
  margin: 0 auto;
}

/* Form Shell */
.rma-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
}

.form-section {
  margin-bottom: 36px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.form-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-icon {
  color: var(--brand-cyan);
  display: flex;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.full-width {
  grid-column: span 2;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: space-between;
}

.field-label span.req {
  color: #f87171;
}

.field-hint {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.input-control, .select-control, .textarea-control {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #ffffff;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.input-control:focus, .select-control:focus, .textarea-control:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.25);
  background: rgba(10, 20, 45, 0.95);
  color: #ffffff;
}

/* Evitar fondo blanco del autocompletado del navegador (Autofill) */
.input-control:-webkit-autofill,
.input-control:-webkit-autofill:hover, 
.input-control:-webkit-autofill:focus,
.select-control:-webkit-autofill,
.select-control:-webkit-autofill:hover,
.select-control:-webkit-autofill:focus {
  -webkit-text-fill-color: #ffffff !important;
  -webkit-box-shadow: 0 0 0px 1000px #0a142d inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

.select-control option {
  background-color: #0b193c;
  color: #ffffff;
}

/* Campo de teléfono con bandera de país */
.phone-input {
  display: flex;
  align-items: stretch;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s ease;
}

.phone-input:focus-within {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.25);
  background: rgba(10, 20, 45, 0.95);
}

.phone-flag {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 1.25rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.05);
  border-right: 1px solid var(--input-border);
  user-select: none;
}

.phone-input .input-control {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.phone-input .input-control:focus {
  border: none;
  background: transparent;
  box-shadow: none;
}

.textarea-control {
  resize: vertical;
  min-height: 100px;
}

/* Upload Grid */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.upload-box {
  background: rgba(10, 20, 45, 0.5);
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}

.upload-box:hover, .upload-box.dragover {
  border-color: var(--brand-cyan);
  background: rgba(15, 98, 254, 0.08);
}

.upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  color: var(--brand-cyan);
  margin-bottom: 8px;
}

.upload-label-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
}

.upload-label-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.upload-preview {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}

.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-preview .pdf-indicator {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 30, 65, 0.95);
  color: #ffffff;
  padding: 12px;
  font-size: 0.8rem;
}

.remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s ease;
}

.remove-btn:hover {
  transform: scale(1.1);
}

/* Submit Section */
.submit-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--brand-blue) 0%, #194ef5 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--brand-glow);
  transition: all 0.25 ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(15, 98, 254, 0.6);
  background: linear-gradient(135deg, #1952fe 0%, #295dfa 100%);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Banner de error en línea (reemplaza los alert() del navegador) */
.form-error {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
  animation: form-error-in 0.25s ease;
}

.form-error[hidden] {
  display: none;
}

.form-error-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.form-error-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.form-error-title {
  color: #fee2e2;
  font-weight: 600;
}

.form-error-detail {
  color: rgba(254, 226, 226, 0.85);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

@keyframes form-error-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Ticket Confirmation Card */
.ticket-success-card {
  display: none;
  background: var(--card-bg);
  border: 1px solid rgba(71, 197, 243, 0.4);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.success-badge-icon {
  width: 72px;
  height: 72px;
  background: rgba(37, 211, 102, 0.15);
  border: 2px solid var(--accent-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-green);
  margin: 0 auto 20px;
}

.ticket-number-box {
  background: rgba(10, 20, 45, 0.8);
  border: 1px dashed var(--brand-cyan);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 24px 0;
}

.ticket-label {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.ticket-id {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--brand-cyan);
  font-family: monospace;
}

.ticket-details-grid {
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 28px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  font-size: 0.9rem;
}

.ticket-detail-item strong {
  color: var(--text-muted);
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.whatsapp-action-btn {
  background: #25D366;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
}

.whatsapp-action-btn:hover {
  background: #20bd5a;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4);
}

.footer {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: auto;
}

@media (max-width: 640px) {
  .form-grid, .upload-grid, .ticket-details-grid {
    grid-template-columns: 1fr;
  }
  .full-width {
    grid-column: span 1;
  }
  .rma-card {
    padding: 24px 18px;
  }
}
