/* ============================================
   NoSeMeOlvida - Estilos
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: #f5f7fa;
  color: #1a1a1a;
  min-height: 100vh;
  padding: 20px;
}

/* ============================================
   LOGIN / REGISTRO
   ============================================ */

#seccion-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.container-login {
  width: 100%;
  max-width: 420px;
}

.header-login {
  text-align: center;
  margin-bottom: 30px;
}

.header-login h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

.subtitle {
  color: #666;
  font-size: 14px;
}

.card-login {
  background: white;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: #f1f3f6;
  padding: 4px;
  border-radius: 10px;
}

.tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.activo {
  background: #4f46e5;
  color: white;
}

.tab:hover:not(.activo) {
  color: #333;
}

/* Formularios */
#form-login,
#form-registro {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input {
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  transition: border 0.2s;
}

input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

button[type="submit"] {
  padding: 12px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

button[type="submit"]:hover {
  background: #4338ca;
}

.mensaje {
  margin-top: 16px;
  padding: 10px;
  font-size: 14px;
  color: #666;
  text-align: center;
  border-radius: 8px;
  min-height: 20px;
}

/* ============================================
   APP (después de login)
   ============================================ */

#seccion-app .container {
  max-width: 500px;
  margin: 0 auto;
}

#seccion-app header {
  text-align: center;
  margin-bottom: 30px;
}

#seccion-app header h1 {
  font-size: 28px;
  margin-bottom: 5px;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
  padding: 10px 15px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  font-size: 14px;
}

#user-email {
  color: #666;
}

#btn-cerrar-sesion {
  padding: 6px 12px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-cerrar-sesion:hover {
  background: #4338ca;
}

h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #333;
}

/* Formulario de vencimiento */
.form-section {
  background: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

#form-vencimiento {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Lista de vencimientos */
.lista-section {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.vencimiento {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 10px;
  border-left: 4px solid #ccc;
  background: #fafafa;
}

.vencimiento.rojo {
  border-left-color: #ef4444;
  background: #fef2f2;
}

.vencimiento.amarillo {
  border-left-color: #f59e0b;
  background: #fffbeb;
}

.vencimiento.verde {
  border-left-color: #10b981;
  background: #f0fdf4;
}

.info {
  flex: 1;
}

.nombre {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 3px;
}

.dias {
  font-size: 13px;
  color: #666;
}

.btn-eliminar {
  background: transparent;
  color: #999;
  padding: 8px;
  font-size: 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-eliminar:hover {
  background: #fee2e2;
  color: #ef4444;
}

.vacio {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 20px 0;
}

/* Responsive */
@media (max-width: 500px) {
  body {
    padding: 15px;
  }
  
  .card-login {
    padding: 24px 20px;
  }
  
  #seccion-app header h1 {
    font-size: 24px;
  }
}

/* Botón editar */
.btn-editar {
  background: transparent;
  color: #999;
  padding: 8px;
  font-size: 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  margin-right: 4px;
}

.btn-editar:hover {
  background: #e0e7ff;
  color: #4f46e5;
}

/* ============================================
   MODAL EDITAR VENCIMIENTO
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-title {
  font-size: 20px;
  color: #1a1a1a;
  margin-bottom: 20px;
  text-align: center;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-label {
  font-size: 14px;
  color: #666;
  font-weight: 500;
  margin-bottom: -4px;
}

.modal-botones {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.btn-cancelar {
  flex: 1;
  padding: 12px;
  background: #f1f3f6;
  color: #666;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-cancelar:hover {
  background: #e0e3e8;
}

.btn-guardar {
  flex: 1;
  padding: 12px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-guardar:hover {
  background: #4338ca;
}

/* ============================================
   BUSCADOR DE VENCIMIENTOS
   ============================================ */

.buscador {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  background: #fafafa;
  transition: all 0.2s;
}

.buscador:focus {
  outline: none;
  border-color: #4f46e5;
  background: white;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.buscador::placeholder {
  color: #999;
}

/* ============================================
   FILTROS POR CATEGORÍA
   ============================================ */

.filtros-categoria {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filtro-btn {
  padding: 8px 14px;
  background: #f1f3f6;
  color: #666;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filtro-btn:hover {
  background: #e0e3e8;
}

.filtro-btn.activo {
  background: #4f46e5;
  color: white;
}

.filtro-btn.activo:hover {
  background: #4338ca;
}

/* ============================================
   NOTAS EN VENCIMIENTOS
   ============================================ */

.notas {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
  font-style: italic;
  padding: 4px 8px;
  background: #fafafa;
  border-radius: 6px;
  border-left: 3px solid #c7d2fe;
}

/* ============================================
   TOGGLE PRÓXIMOS / HISTORIAL
   ============================================ */

.toggle-vista {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  background: #f1f3f6;
  padding: 4px;
  border-radius: 10px;
}

.vista-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  color: #666;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.vista-btn:hover:not(.activo) {
  color: #333;
}

.vista-btn.activo {
  background: white;
  color: #4f46e5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Botón ✓ (marcar como pagado) */
.btn-completar {
  background: transparent;
  color: #999;
  padding: 8px;
  font-size: 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  margin-right: 4px;
}

.btn-completar:hover {
  background: #dcfce7;
  color: #16a34a;
}

/* ============================================
   LOADER / SPINNER
   ============================================ */

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #666;
  font-size: 14px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e7ff;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

/* ============================================
   TOAST (MENSAJES EMERGENTES)
   ============================================ */

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: white;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  animation: toastIn 0.3s ease-out;
  max-width: 90%;
  text-align: center;
}

.toast.error {
  background: #ef4444;
}

.toast.success {
  background: #10b981;
}

.toast.info {
  background: #4f46e5;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

/* Botón Eliminar (rojo) */
.btn-eliminar-confirmar {
  flex: 1;
  padding: 12px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-eliminar-confirmar:hover {
  background: #dc2626;
}

/* ============================================
   ANIMACIONES SUAVES
   ============================================ */

/* Fade-in de tarjetas */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.vencimiento {
  animation: fadeInUp 0.3s ease-out;
  transition: transform 0.2s, box-shadow 0.2s;
}

.vencimiento:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Transición de la lista */
#lista {
  transition: opacity 0.3s ease;
}

/* Transición del toggle */
.vista-btn {
  transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}

/* Transición de filtros */
.filtro-btn {
  transition: background 0.2s, color 0.2s;
}

/* Transición del buscador */
.buscador {
  transition: border-color 0.2s, box-shadow 0.2s;
}
