/* auth.css - Premium Authentication styles (Login & Register) styled after the organic Spacer split-card mockup */

body {
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, var(--color-bg) 0%, var(--color-accent-warm) 100%);
  padding: 2rem;
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

/* ── CONTAINER CARD ── */
.auth-layout {
  display: flex;
  width: 100%;
  max-width: 840px; /* Slightly wider for gorgeous form columns */
  height: 640px; /* Fixed elegant height to keep layout stable and scroll internally */
  max-height: calc(100vh - 3rem);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 20px 48px rgba(26, 18, 8, 0.08),
    0 4px 16px rgba(26, 18, 8, 0.04);
  border: 1px solid var(--color-border);
  position: relative;
  background: var(--color-surface);
  transition: max-width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Registration card dimensions kept strictly identical to keep container size fixed */
.auth-layout-register {
  max-width: 840px;
  height: 640px;
  max-height: calc(100vh - 3rem);
}
.auth-layout-register .auth-right {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

/* ─────────────────────────────────────────
   LEFT PANEL — brand & context info
   ───────────────────────────────────────── */
.auth-left {
  width: 42%;
  height: 100%;
  background: var(--color-primary);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 3rem 4.5rem 2.5rem 2.25rem; /* Increased right padding to prevent overlapping with wave divider */
  z-index: 2;
  color: #ffffff;
  box-sizing: border-box;
}

/* Multi-layered organic wave dividers styled after the Spacer mockup */
.wave-divider {
  position: absolute;
  top: 0;
  right: -60px;
  height: 100%;
  width: 120px;
  z-index: 3;
  pointer-events: none;
}

.wave-layer-bg-cream {
  fill: var(--color-surface);
  opacity: 1;
}

.wave-layer-1 {
  fill: var(--color-primary-light);
  opacity: 0.35;
  transform: translateX(18px);
}

.wave-layer-2 {
  fill: var(--color-primary);
  opacity: 0.6;
  transform: translateX(9px);
}

.wave-layer-3 {
  fill: var(--color-primary);
  opacity: 1;
  transform: translateX(0);
}

/* Navigation back link */
.back-link-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.back-btn {
  color: var(--color-accent-warm);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.25s ease;
}

.back-btn:hover {
  background: #ffffff;
  color: var(--color-primary);
  transform: translateX(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.back-text {
  color: var(--color-accent-warm);
  opacity: 0.85;
  font-size: 0.82rem;
  font-weight: 500;
}

/* Language switcher standard alignment */
.auth-left .lang-switcher {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 2.5rem;
  font-family: var(--font-body);
}

.auth-left .lang-switcher span {
  color: var(--color-accent-warm);
  opacity: 0.4;
  font-size: 0.8rem;
  user-select: none;
}

.auth-left .lang-switcher button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--color-accent-warm);
  opacity: 0.85;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-left .lang-switcher button:hover {
  border-color: #ffffff;
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.auth-left .lang-switcher button.active {
  background: #ffffff;
  color: var(--color-primary);
  border-color: #ffffff;
  opacity: 1;
  box-shadow: var(--shadow-xs);
}

/* Brand left messages */
.auth-left-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  color: #ffffff;
}

.auth-left-subtitle {
  font-size: 0.95rem;
  color: var(--color-accent-warm);
  opacity: 0.9;
  line-height: 1.6;
}

/* Context checkpoints list */
.auth-points-list {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 2rem;
}

.auth-point {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0.9;
  font-size: 0.88rem;
  color: var(--color-accent-warm);
}

.auth-point i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  color: #ffffff;
}

/* ─────────────────────────────────────────
   RIGHT PANEL — authentication form
   ───────────────────────────────────────── */
.auth-right {
  width: 58%;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 3.5rem 3rem 3rem 4rem;
  position: relative;
  z-index: 0;
  overflow-y: auto;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

/* Custom premium scrollbar for the scrollable form panel */
.auth-right::-webkit-scrollbar {
  width: 6px;
}

.auth-right::-webkit-scrollbar-track {
  background: transparent;
}

.auth-right::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

.auth-right::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-light);
}

.auth-box {
  width: 100%;
}

/* Brand logotype link */
.auth-right .navbar-brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 1.5rem;
  display: inline-block;
  letter-spacing: -0.01em;
}

.auth-right .navbar-brand span {
  color: var(--color-primary);
}

.auth-box h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.auth-box .text-muted {
  font-size: 0.88rem;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

/* Forms general styling & smooth micro-animations */
form:not(.hidden) {
  animation: slideUpFade 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1.25rem;
  position: relative;
}

.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Modern minimal fields (underline only) */
.form-control {
  border: none;
  border-bottom: 1.5px solid var(--color-border);
  background: transparent;
  padding: 0.5rem 0;
  border-radius: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.25s ease;
  width: 100%;
}

.form-control:focus {
  border-bottom-color: var(--color-primary);
  box-shadow: none;
}

.form-control::placeholder {
  color: var(--color-muted);
  opacity: 0.45;
  font-size: 0.88rem;
}

/* Custom styled inputs for large textareas & files */
textarea.form-control {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  background: var(--color-bg);
  resize: vertical;
  min-height: 80px;
}

textarea.form-control:focus {
  border-color: var(--color-primary);
  background: #ffffff;
}

select.form-control {
  border-bottom: 1.5px solid var(--color-border);
  cursor: pointer;
  appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%237a6e64' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 4px center;
  background-size: 12px;
  padding-right: 1.5rem;
}

select.form-control:focus {
  border-bottom-color: var(--color-primary);
}

input[type="file"].form-control {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  background: var(--color-bg);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--color-muted);
}

input[type="file"].form-control:hover {
  border-color: var(--color-primary);
  background: var(--color-accent-warm);
}

.form-hint {
  font-size: 0.76rem;
  color: var(--color-muted);
  opacity: 0.8;
  margin-top: 0.25rem;
}

/* ── ERROR ALERTS ── */
#error-msg, #login-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.75rem 1.15rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #fecaca;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#error-msg.hidden, #login-error.hidden {
  display: none !important;
}

/* ── ROLE CHOOSE CARDS ── */
.type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.type-card {
  border-radius: 12px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border) !important;
  padding: 1.25rem 1rem !important;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s var(--transition, ease);
  user-select: none;
}

.type-card:hover {
  transform: translateY(-2.5px);
  border-color: var(--color-primary-light) !important;
  background: var(--color-accent-warm);
}

.type-card.active {
  border-color: var(--color-primary) !important;
  background: #ffffff !important;
  box-shadow: var(--shadow-sm);
}

.type-card .type-title {
  font-weight: 600;
  margin-top: 0.5rem;
  font-size: 0.92rem;
  color: var(--color-text);
}

.type-card .type-desc {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-top: 0.15rem;
}

.type-card i {
  color: var(--color-primary-light);
  margin-bottom: 0.35rem;
  display: inline-block;
  transition: color 0.2s;
}

.type-card.active i {
  color: var(--color-primary);
}

/* ── CHECKBOX ── */
.checkbox-label {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.85rem;
  color: var(--color-muted);
  line-height: 1.45;
  cursor: pointer;
  user-select: none;
  margin-bottom: 1.5rem;
}

.checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--color-primary);
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

/* ── BUTTONS & DIVIDERS ── */
.divider {
  border: 0;
  height: 1px;
  background: var(--color-border);
  margin: 1.75rem 0;
}

.btn {
  border-radius: 24px;
  padding: 0.65rem 1.75rem;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.01em;
  text-transform: none;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  border: 1.5px solid var(--color-primary);
  box-shadow: 0 4px 12px rgba(193, 68, 14, 0.18);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-1.5px);
  box-shadow: 0 6px 18px rgba(163, 58, 11, 0.28);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Layout helper classes */
.mobile-only {
  display: none !important;
}
.desktop-only {
  display: block !important;
}
nav.desktop-only {
  display: flex !important;
}

/* Password field wrapper */
.password-input-wrapper {
  position: relative;
  width: 100%;
}
.password-input-wrapper .form-control {
  padding-right: 2.5rem !important;
}
.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  cursor: pointer;
  font-size: 1.05rem;
  transition: color 0.2s ease;
  z-index: 10;
}
.toggle-password:hover {
  color: var(--color-primary);
}

/* Forgot password link styles */
.forgot-password-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.4rem;
}
.forgot-password-link {
  font-size: 0.8rem;
  color: #c1440e;
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s;
}
.forgot-password-link:hover {
  opacity: 0.8;
}

/* Artisan section subheader */
.artisan-section-divider {
  margin: 2rem 0 1.25rem 0;
  border-top: 1px solid var(--color-border);
  padding-top: 1.5rem;
}
.artisan-section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #c1440e;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Custom Dotted Dragzone File Upload */
.custom-file-upload {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.25rem;
  border: 1.5px dashed #ebdcd0;
  border-radius: 16px;
  background: #faf8f5;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 0.35rem;
  position: relative;
  box-sizing: border-box;
}
.custom-file-upload:hover {
  border-color: var(--color-primary);
  background: #ffffff;
}
.custom-file-upload i {
  font-size: 1.75rem;
  color: var(--color-muted);
  opacity: 0.7;
}
.custom-file-upload .upload-text-container {
  flex-grow: 1;
}
.custom-file-upload .upload-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.15rem;
}
.custom-file-upload .upload-subtitle {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 0.15rem;
}
.custom-file-upload .btn-upload {
  background: transparent;
  color: #c1440e;
  border: 1px solid #c1440e;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none; /* Let label handling click it */
}

/* ─── CHIPS / SELECTOR OVERRIDES ─── */
.type-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ─────────────────────────────────────────
   RESPONSIVE LAYOUT
   ───────────────────────────────────────── */
@media (max-width: 860px) {
  html,
  body {
    min-height: 100dvh;
    height: auto;
    padding: 0 !important;
    padding-bottom: 0 !important;
    display: block !important;
    align-items: stretch;
    background: #faf8f5 !important;
    overflow-y: auto !important;
  }

  .mobile-bottom-nav {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .mobile-only {
    display: block !important;
  }
  .desktop-only {
    display: none !important;
  }

  .auth-layout, .auth-layout-register {
    flex-direction: column;
    border-radius: 0;
    border: none;
    box-shadow: none;
    min-height: 100dvh;
    height: auto;
    max-height: none;
    max-width: 100%;
    overflow: visible !important;
    background: #faf8f5 !important;
  }

  .auth-left {
    display: none !important; /* Hide left panel completely on mobile */
  }

  .wave-divider {
    display: none;
  }

  .auth-right {
    width: 100% !important;
    min-height: 100dvh;
    height: auto !important;
    padding: 0.5rem 1.25rem calc(3rem + env(safe-area-inset-bottom)) 1.25rem !important;
    background: #faf8f5 !important;
    overflow: visible !important;
    box-sizing: border-box;
  }

  /* White premium overlay card */
  .auth-box {
    width: 100%;
    background: #ffffff;
    border-radius: 24px;
    padding: 1.75rem 1.5rem 1.85rem;
    box-shadow: 0 12px 40px rgba(139, 90, 43, 0.05);
    border: 1.5px solid #ebdcd0;
    box-sizing: border-box;
    margin-bottom: 1rem;
  }

  /* Form Titles */
  .auth-box h2 {
    font-size: 1.35rem !important;
    font-weight: 800 !important;
    font-family: var(--font-display) !important;
    color: #261f1b !important;
    margin-bottom: 0.4rem !important;
  }

  /* Capsule/Pill form fields */
  .form-control {
    border: 1.5px solid #ebdcd0 !important;
    border-radius: 16px !important;
    background: #faf8f5 !important;
    padding: 0.75rem 1.1rem !important;
    font-size: 0.92rem !important;
    color: var(--color-text) !important;
    box-sizing: border-box !important;
    height: auto !important;
    transition: all 0.25s ease !important;
    width: 100% !important;
  }

  .form-control:focus {
    border-color: var(--color-primary) !important;
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(193, 68, 14, 0.05) !important;
  }

  /* Textarea custom padding */
  textarea.form-control {
    border-radius: 16px !important;
    padding: 0.85rem 1.1rem !important;
    min-height: 100px !important;
  }

  /* Dotted file uploads fine-tuning */
  .custom-file-upload {
    background: #faf8f5 !important;
    border: 1.5px dashed #ebdcd0 !important;
  }
  .custom-file-upload:hover {
    background: #ffffff !important;
    border-color: var(--color-primary) !important;
  }

  /* Button styling */
  .btn {
    border-radius: 24px !important;
    padding: 0.85rem 2rem !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    height: auto !important;
  }

  /* Role toggle segmented bar styling */
  .type-selector {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 4px !important;
    background: #faf8f5 !important;
    border: 1.5px solid #ebdcd0 !important;
    border-radius: 16px !important;
    padding: 4px !important;
    margin-bottom: 1.5rem !important;
  }

  .type-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    padding: 0.65rem 1rem !important;
    background: transparent !important;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    transform: none !important;
    margin: 0 !important;
    height: auto !important;
  }
  .type-card:hover {
    transform: none !important;
    background: rgba(193, 68, 14, 0.05) !important;
  }

  .type-card .type-title {
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    color: var(--color-muted) !important;
    margin: 0 !important;
    transition: color 0.2s !important;
  }

  .type-card .type-desc {
    display: none !important; /* Hide description on mobile */
  }

  .type-card .type-icon-wrapper i {
    font-size: 1rem !important;
    color: var(--color-muted) !important;
    margin: 0 !important;
    transition: color 0.2s !important;
  }

  /* Active toggled role style */
  .type-card.active {
    background: #c1440e !important; /* Rust orange active */
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(193, 68, 14, 0.15) !important;
  }
  .type-card.active .type-title {
    color: #ffffff !important;
  }
  .type-card.active .type-icon-wrapper i {
    color: #ffffff !important;
  }

  /* Mobile page header (Crear Cuenta) */
  .mobile-auth-header {
    display: flex !important;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0.5rem 1.5rem 0.5rem;
    width: 100%;
    box-sizing: border-box;
  }
  .mobile-page-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    color: #261f1b;
    margin: 0;
  }
  .mobile-back-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    color: #261f1b;
    border: 1px solid #ebdcd0;
    text-decoration: none;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    transition: all 0.2s;
  }

  /* Mobile Login Header (Brand Logo Banner) */
  .mobile-auth-header-login {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 1.35rem 0.5rem 1.6rem 0.5rem;
    width: 100%;
    box-sizing: border-box;
  }
  .mobile-auth-header-login .mobile-back-arrow {
    position: absolute;
    left: 0.5rem;
    top: 1rem;
  }
  .mobile-logo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
  }
  .mobile-logo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #c1440e; /* Terracotta block */
    color: #ffffff;
    font-size: 1.55rem;
    box-shadow: 0 8px 24px rgba(193, 68, 14, 0.25);
  }
  .mobile-brand-title {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 900;
    color: #261f1b;
    margin: 0;
    letter-spacing: -0.01em;
  }
  .mobile-brand-subtitle {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin: 0;
    font-weight: 500;
  }
}
