/* ============================================================
   NutriCore — Custom Glassmorphism Design System
   Complementa Tailwind CSS v3
   ============================================================ */

/* ----------------------------------------------------------
   0. Base & Global
   ---------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  background-color: #0f172a; /* Evita fondo blanco en rebotes y scroll rápido en móvil */
}

body.bg-gradient-body {
  background-color: #0f172a; /* Fallback y fondo base */
  background: linear-gradient(135deg,
    #0f172a 0%,
    #1e3a5f 25%,
    #2d1b69 50%,
    #1e3a5f 75%,
    #0f172a 100%
  );
  background-attachment: fixed;
  min-height: 100vh;
}

/* ----------------------------------------------------------
   1. Glass Card — dark variant (dashboards, admin)
   ---------------------------------------------------------- */
.glass-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ----------------------------------------------------------
   2. Glass Card Light — public / content pages
   ---------------------------------------------------------- */
.glass-card-light {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 1rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  color: #1e293b;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card-light:hover {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* ----------------------------------------------------------
   3. Glass Navigation Bar
   ---------------------------------------------------------- */
.glass-nav {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.3s ease;
}

.glass-nav.scrolled {
  background: rgba(15, 23, 42, 0.95);
}

/* ----------------------------------------------------------
   4. Glass Input
   ---------------------------------------------------------- */
.glass-input {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  color: #ffffff;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  outline: none;
  width: 100%;
}

.glass-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.glass-input:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
  background: rgba(255, 255, 255, 0.15);
}

/* Light input variant for public pages */
.glass-input-light {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  color: #1e293b;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  outline: none;
  width: 100%;
}

.glass-input-light::placeholder {
  color: rgba(30, 41, 59, 0.5);
}

.glass-input-light:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
  background: rgba(255, 255, 255, 0.75);
}

/* ----------------------------------------------------------
   5. Glass Buttons
   ---------------------------------------------------------- */

/* Primary — emerald-to-cyan gradient */
.glass-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: linear-gradient(135deg, #34d399, #22d3ee);
  color: #0f172a;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
  box-shadow: 0 4px 15px rgba(52, 211, 153, 0.3);
  text-decoration: none;
  line-height: 1.4;
}

.glass-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(52, 211, 153, 0.45);
  filter: brightness(1.08);
}

.glass-button:active {
  transform: scale(0.98);
}

.glass-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* Secondary — outline */
.glass-button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: transparent;
  color: #ffffff;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
  text-decoration: none;
  line-height: 1.4;
}

.glass-button-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.glass-button-secondary:active {
  transform: translateY(0);
}

/* Danger button */
.glass-button-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: linear-gradient(135deg, #f87171, #ef4444);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
  text-decoration: none;
  line-height: 1.4;
}

.glass-button-danger:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.45);
}

/* ----------------------------------------------------------
   6. Custom Scrollbar
   ---------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #34d399, #22d3ee);
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.3);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6ee7b7, #67e8f9);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #34d399 rgba(15, 23, 42, 0.4);
}

/* ----------------------------------------------------------
   7. Loading Spinner
   ---------------------------------------------------------- */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #34d399;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-lg {
  width: 56px;
  height: 56px;
  border-width: 4px;
}

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

/* ----------------------------------------------------------
   8. Hover Lift Effect
   ---------------------------------------------------------- */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(52, 211, 153, 0.08);
}

/* ----------------------------------------------------------
   9. Gradient Text
   ---------------------------------------------------------- */
.gradient-text {
  background: linear-gradient(135deg, #34d399, #22d3ee, #a78bfa);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 6s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* ----------------------------------------------------------
   10. Pulse Dot — notification indicator
   ---------------------------------------------------------- */
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  position: relative;
  animation: pulseDot 2s ease-in-out infinite;
}

.pulse-dot::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.4);
  animation: pulseDotRing 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.7; }
}

@keyframes pulseDotRing {
  0%   { transform: scale(1); opacity: 0.6; }
  50%  { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

/* ----------------------------------------------------------
   11. Component Preview — page builder
   ---------------------------------------------------------- */
.component-preview {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  padding: 1rem;
  cursor: grab;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

.component-preview:hover {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.component-preview:active {
  cursor: grabbing;
}

.component-preview.sortable-chosen {
  border-color: #34d399;
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.2);
}

.component-preview.sortable-ghost {
  opacity: 0.4;
}

/* ----------------------------------------------------------
   12. Page Transition
   ---------------------------------------------------------- */
.page-transition {
  animation: pageTransitionIn 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes pageTransitionIn {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ----------------------------------------------------------
   13. Scroll Animations
   ---------------------------------------------------------- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delays for child elements */
.animate-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.animate-on-scroll:nth-child(3) { transition-delay: 0.2s; }
.animate-on-scroll:nth-child(4) { transition-delay: 0.3s; }
.animate-on-scroll:nth-child(5) { transition-delay: 0.4s; }
.animate-on-scroll:nth-child(6) { transition-delay: 0.5s; }

/* ----------------------------------------------------------
   14. Transition Utilities
   ---------------------------------------------------------- */
.transition-smooth {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.transition-fast {
  transition: all 0.15s ease;
}

.transition-slow {
  transition: all 0.5s ease;
}

/* ----------------------------------------------------------
   15. Misc Utilities
   ---------------------------------------------------------- */

/* Badge — used for status indicators, counts */
.glass-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 9999px;
  background: linear-gradient(135deg, #34d399, #22d3ee);
  color: #0f172a;
  line-height: 1.4;
  min-width: 1.25rem;
}

/* Glass Select */
.glass-select {
  appearance: none;
  background: rgba(255, 255, 255, 0.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E") right 0.75rem center / 1.25rem no-repeat;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.75rem;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-select:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

/* Glass Textarea */
.glass-textarea {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  color: #ffffff;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 100px;
  outline: none;
  width: 100%;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.glass-textarea:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

/* Glass Table */
.glass-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.glass-table thead th {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-table thead th:first-child {
  border-top-left-radius: 0.75rem;
}

.glass-table thead th:last-child {
  border-top-right-radius: 0.75rem;
}

.glass-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
}

.glass-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.glass-table tbody tr:last-child td {
  border-bottom: none;
}

.glass-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 0.75rem;
}

.glass-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 0.75rem;
}

/* Overlay for modals */
.glass-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
}

/* Toast notification base */
.glass-toast {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  animation: slideInRight 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(100%);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}
