/**
 * 🔐 Estilos del Sistema de Autenticación - Tema Oscuro Compacto
 */

/* =====================================================
   BOTÓN DE CUENTA EN HEADER
   ===================================================== */

.user-account-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  color: var(--color-text, #1f2937);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-account-btn:hover {
  background: var(--color-primary, #FF6B00);
  border-color: var(--color-primary, #FF6B00);
  color: white;
}

.user-account-btn .user-icon {
  font-size: 1.1rem;
}

.user-account-btn.logged-in {
  background: var(--color-primary-light, #fff7ed);
  border-color: var(--color-primary, #FF6B00);
  color: var(--color-primary, #FF6B00);
}

.header__account-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  color: var(--color-text, #1f2937);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header__account-btn:hover {
  background: var(--color-primary, #FF6B00);
  border-color: var(--color-primary, #FF6B00);
  color: white;
}

.header__account-btn .account-icon {
  font-size: 1.1rem;
}

.header__account-btn .account-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header__account-btn.logged-in {
  background: var(--color-primary-light, #fff7ed);
  border-color: var(--color-primary, #FF6B00);
}

.header__account-btn.logged-in .account-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

/* =====================================================
   MODAL DE AUTENTICACIÓN - Tema Oscuro Compacto
   ===================================================== */

.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.auth-modal.auth-modal--open {
  display: flex;
}

.auth-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.auth-modal__content {
  position: relative;
  width: 100%;
  max-width: 340px;
  max-height: 85vh;
  background: #1a1a2e;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: authModalIn 0.25s ease;
  border: 1px solid rgba(255, 107, 0, 0.3);
}

@keyframes authModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, #FF6B00, #ff8533);
  color: white;
}

.auth-modal__header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.auth-modal__close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  line-height: 1;
}

.auth-modal__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Tabs */
.auth-tabs {
  display: flex;
  background: #16162a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tab {
  flex: 1;
  padding: 0.625rem;
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 500;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.auth-tab:hover {
  color: #FF6B00;
}

.auth-tab.active {
  color: #FF6B00;
}

.auth-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #FF6B00;
}

/* Forms */
.auth-form {
  display: none;
  padding: 1rem;
}

.auth-form.active {
  display: block;
}

.auth-form__group {
  margin-bottom: 0.75rem;
}

.auth-form__label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #9ca3af;
}

.auth-form__input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  font-size: 0.85rem;
  background: #16162a;
  color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.auth-form__input:focus {
  outline: none;
  border-color: #FF6B00;
  box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.2);
}

.auth-form__input::placeholder {
  color: #6b7280;
}

/* Botones */
.auth-btn {
  width: 100%;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-btn--primary {
  background: linear-gradient(135deg, #FF6B00, #ff8533);
  color: white;
  margin-top: 0.5rem;
}

.auth-btn--primary:hover {
  background: linear-gradient(135deg, #e55f00, #FF6B00);
  transform: translateY(-1px);
}

.auth-btn--primary:disabled {
  background: #374151;
  cursor: not-allowed;
  transform: none;
}

.auth-btn--google {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #374151;
  margin-bottom: 0.75rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
}

.auth-btn--google:hover {
  background: #f3f4f6;
}

.auth-btn--google img {
  width: 16px;
  height: 16px;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 0.75rem 0;
  color: #6b7280;
  font-size: 0.7rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-divider span {
  padding: 0 0.75rem;
}

/* Links */
.auth-link {
  color: #FF6B00;
  text-decoration: none;
  font-size: 0.75rem;
  cursor: pointer;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-forgot {
  display: block;
  text-align: right;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

/* Mensajes */
.auth-message {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
}

.auth-message--error {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.auth-message--success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Footer */
.auth-footer {
  padding: 0.75rem 1rem;
  background: #16162a;
  text-align: center;
  font-size: 0.65rem;
  color: #6b7280;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-footer a {
  color: #FF6B00;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}


/* =====================================================
   DROPDOWN DE USUARIO (cuando está logueado)
   ===================================================== */

.user-dropdown {
  position: relative;
}

.user-dropdown__menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  min-width: 200px;
  background: #1a1a2e;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 107, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.user-dropdown.open .user-dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown__header {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-dropdown__name {
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.25rem;
}

.user-dropdown__email {
  font-size: 0.85rem;
  color: #9ca3af;
}

.user-dropdown__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #d1d5db;
  text-decoration: none;
  transition: background 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  font-size: 0.95rem;
}

.user-dropdown__item:hover {
  background: rgba(255, 107, 0, 0.1);
  color: #FF6B00;
}

.user-dropdown__item--danger {
  color: #f87171;
}

.user-dropdown__item--danger:hover {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
}

/* =====================================================
   INTEGRACIÓN CON CARRITO
   ===================================================== */

/* Sección de usuario logueado en el carrito */
.cart-user-section {
  display: none; /* Se muestra via JS cuando hay usuario logueado */
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 107, 0, 0.1);
  border: 1px solid rgba(255, 107, 0, 0.3);
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Tema oscuro para el carrito */
.cart-modal .cart-user-section {
  background: rgba(255, 107, 0, 0.15);
  border-color: rgba(255, 107, 0, 0.4);
}

.cart-user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.cart-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #FF6B00;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.cart-user-name {
  font-weight: 500;
  color: #374151;
}

/* Tema oscuro */
.cart-modal .cart-user-name {
  color: #e5e7eb;
}

.cart-user-change {
  padding: 0.25rem 0.5rem;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #6b7280;
  cursor: pointer;
}

.cart-user-change:hover {
  border-color: #FF6B00;
  color: #FF6B00;
}

.cart-login-prompt {
  padding: 0.75rem 1rem;
  background: rgba(255, 107, 0, 0.1);
  border: 1px solid rgba(255, 107, 0, 0.2);
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #9ca3af;
  text-align: center;
}

.cart-login-prompt a {
  color: #FF6B00;
  font-weight: 500;
  text-decoration: none;
}

.cart-login-prompt a:hover {
  text-decoration: underline;
}

.saved-addresses-selector {
  margin-bottom: 1rem;
}

.saved-addresses-selector label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #9ca3af;
}

.saved-addresses-selector select {
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  font-size: 0.9rem;
  background: #16162a;
  color: #fff;
  cursor: pointer;
}

.saved-addresses-selector select:focus {
  outline: none;
  border-color: #FF6B00;
}

.save-address-option {
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.save-address-option label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #9ca3af;
  cursor: pointer;
}

.save-address-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #FF6B00;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 480px) {
  .auth-modal__content {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .header__account-btn .account-name {
    display: none;
  }

  .header__account-btn {
    padding: 0.5rem;
  }
}
