@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@700;800;900&family=Jost:wght@400;500;700&display=swap');

:root {
  --font-heading: 'Figtree', sans-serif;
  --font-body: 'Jost', sans-serif;
  --color-primary: #4F46E5;
  --color-primary-dark: #4338CA;
  --color-primary-glow: rgba(79, 70, 229, 0.4);
  --color-text: #0A0A0A;
  --color-text-secondary: #6b7280;
  --color-border: #E5E7EB;
  --color-background: #FFFFFF;
  --color-bg-secondary: #F8F9FA;
  --color-light-gray: #f0f2f4;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --header-height: 6rem; /* Definimos la altura del header para cálculos */
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg-secondary);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  /* Importante: Evitamos el scroll en el body */
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 800;
  line-height: 1.2;
}

.main-container {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

#main-header-placeholder {
    height: var(--header-height);
    flex-shrink: 0;
}


/* ===== 💎 THE NEW AESTHETIC & TECHNOLOGICAL HEADER ===== */
.header-glass {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  
  background: rgba(248, 249, 250, 0.65);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);

  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.05);

  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation: gentleAppear 0.8s ease-out;
  position: relative; 
}


.header-glass::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    margin: -1px;
    border-radius: inherit;
    background: radial-gradient(
        800px circle at var(--mouse-x, 200px) var(--mouse-y, 100px),
        rgba(191, 219, 254, 0.3),
        transparent 40%
    );
    animation: auroraGlow 15s linear infinite;
    opacity: 0;
    transition: opacity 0.5s ease;
    overflow: hidden;
}

.header-glass:hover::before {
    opacity: 1;
}

@keyframes auroraGlow {
  0% { --mouse-x: -20%; --mouse-y: -50%; }
  25% { --mouse-x: 120%; --mouse-y: -10%; }
  50% { --mouse-x: 150%; --mouse-y: 120%; }
  75% { --mouse-x: -30%; --mouse-y: 150%; }
  100% { --mouse-x: -20%; --mouse-y: -50%; }
}


.header-scrolled .header-glass {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.15),
    0 2px 8px rgba(79, 70, 229, 0.1);
}

@keyframes gentleAppear {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== DROPDOWNS MEJORADOS (También con efecto Glass) ===== */
#notifications-dropdown, #profile-dropdown {
  backdrop-filter: blur(25px) saturate(180%);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.15),
    0 8px 16px rgba(79, 70, 229, 0.1);
  animation: dropdownAppear 0.3s ease-out;
  transform-origin: top right;
}

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


/* ===== BOTONES DE HEADER CON "ENERGY GLOW" ===== */
#notifications-btn, #profile-dropdown-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 9999px;
  position: relative;
  border: 1px solid transparent;
}
#profile-dropdown-btn img {
  transition: transform 0.3s ease;
}

#notifications-btn:hover, #profile-dropdown-btn:hover {
  background: rgba(79, 70, 229, 0.05);
  box-shadow: 0 0 15px 3px var(--color-primary-glow);
  transform: scale(1.05);
}
#profile-dropdown-btn:hover img {
    transform: scale(1.1);
}

/* ===== NAVEGACIÓN ACTIVA MEJORADA ===== */
nav .nav-link {
  position: relative;
  transition: all 0.3s ease;
  padding-bottom: 5px;
  color: var(--color-text-secondary);
  font-weight: 700;
}

nav .nav-link:hover {
    color: var(--color-primary);
}

nav .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0; 
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

nav .nav-link:hover::after,
nav .nav-link.text-indigo-600::after {
  width: 100%;
}
nav .nav-link.text-indigo-600 {
  color: var(--color-primary);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-secondary {
  background: white;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  transition: all 0.2s ease-in-out;
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.card:hover {
    transform: none; /* Quitamos el hover que no es útil en esta vista */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-color: var(--color-border);
}

.form-group {
  position: relative;
  margin-bottom: 1.5rem;
}

.form-input {
  width: 100%;
  height: 3.5rem;
  padding: 1rem 0.75rem 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  transition: all 0.3s ease-in-out;
  background: white;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  outline: none;
}

.form-label {
  position: absolute;
  top: 1rem;
  left: 0.75rem;
  font-size: 1rem;
  color: var(--color-text-secondary);
  pointer-events: none;
  transition: all 0.2s ease-in-out;
  background: white;
  padding: 0 0.25rem;
}

.form-input:focus ~ .form-label,
.form-input:not(:placeholder-shown) ~ .form-label {
  top: -0.5rem;
  left: 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
}

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translate(20px, -10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

@keyframes gradientFlow {
  0% { background-position: 0% 50% }
  50% { background-position: 100% 50% }
  100% { background-position: 0% 50% }
}

.content-fade-in {
  animation: fadeInUp 0.6s ease-out;
}

.slide-in-right {
  animation: slideInRight 0.5s ease-out;
}

.auth-container {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  overflow-y: auto; /* Damos scroll a las páginas de auth si es necesario */
}

@media (min-width: 1024px) {
  .auth-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

.auth-brand-side {
  padding: 3rem 2rem;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(-45deg, #4f46e5, #7c3aed, #10b981, #f59e0b);
  background-size: 400% 400%;
  animation: gradientFlow 15s ease infinite;
  position: relative;
  overflow: hidden;
}

.auth-brand-side::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(2px);
}

.auth-brand-side > div {
  position: relative;
  z-index: 2;
}

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: #f9fafb;
  position: relative;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 0;
  margin: 0 1.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease-in-out;
  cursor: pointer;
  position: relative;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width 0.3s ease-in-out;
}

.tab-btn:hover {
  color: var(--color-primary);
}

.tab-btn:hover::after,
.tab-btn.active::after {
  width: 100%;
}

.tab-btn.active {
  color: var(--color-primary);
}

.notification {
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  animation: slideInRight 0.3s ease-out;
  border: 1px solid;
}

.notification.success {
  background: var(--color-success);
  color: white;
  border-color: #0fa67a;
}

.notification.error {
  background: var(--color-error);
  color: white;
  border-color: #dc2626;
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 0.5rem;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

.client-item, .appointment-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.client-item:hover, .appointment-item:hover {
  transform: translateX(4px);
  border-color: var(--color-primary) !important;
}

@media (max-width: 768px) {
    .main-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
  .header-glass {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }
  :root {
      --header-height: 5rem;
  }
  .auth-brand-side {
    padding: 2rem 1.5rem;
  }
  
  .auth-form-side {
    padding: 1.5rem;
  }
}

.shadow-glow {
  box-shadow: 0 0 20px rgba(79, 70, 229, 0.15);
}

.text-gradient {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.border-gradient {
  border: 1px solid;
  border-image: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%) 1;
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    transition: all 0.2s ease-in-out;
}
  
.btn-danger:hover {
  background: #fca5a5;
  color: #7f1d1d;
  border-color: #f87171;
}

.appointment-agenda-item {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.3s ease;
}

.appointment-agenda-item:hover {
    background-color: #fafbff;
}

.appointment-agenda-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.appointment-time {
  font-weight: 700;
  color: var(--color-text);
  text-align: right;
  font-size: 0.875rem;
  padding-top: 0.25rem;
}

.appointment-details-card {
  position: relative;
  padding: 1.25rem;
  border-left: 4px solid var(--color-primary);
  background-color: #f8f9fa;
  border-radius: 0 0.75rem 0.75rem 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
  
.appointment-details-card:hover {
    transform: translateY(-4px) translateX(4px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.15);
    border-color: var(--color-primary-dark);
    background-color: white;
}

/* ZetAI */

/* ======================================================= */
/* ===== 💎 ZETAI CHAT V3 - EL DISEÑO REFINADO 💎 ===== */
/* ======================================================= */

#zetai-chat-container {
  position: fixed;
  bottom: 0;
  right: 0;
  left: auto;
  padding: 1rem;
  z-index: 1000;
  pointer-events: none;
  width: 100%;
  max-width: 450px;
  transform: translateY(100%);
  animation: slideInUp 0.5s 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInUp { to { transform: translateY(0); } }

/* La ventana principal del chat */
#zetai-chat-content {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 1.25rem; /* Bordes más pronunciados */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  height: 75vh;
  max-height: 650px;
  overflow: hidden;
  pointer-events: all;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#zetai-chat-container:not(.zetai-minimized) #zetai-chat-content {
    opacity: 1;
    transform: translateY(0);
}

/* Estado Minimizado */
#zetai-chat-container.zetai-minimized {
  transform: translateY(calc(100% - 6.5rem));
}
#zetai-chat-container.zetai-minimized #zetai-chat-content {
  opacity: 0;
  pointer-events: none;
}

/* Barra de controles superior */
#zetai-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  cursor: grab;
}
#zetai-controls p {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--color-text);
}
#zetai-controls button {
  padding: 0.5rem;
  border-radius: 9999px;
  color: var(--color-text-secondary);
  transition: all 0.2s ease;
}
#zetai-controls button:hover {
  background-color: rgba(0,0,0,0.05);
  color: var(--color-text);
}
#zetai-minimize-btn svg { width: 1.25rem; height: 1.25rem; }

/* Área de conversación */
#zetai-conversation-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overscroll-behavior: contain;
}

/* ---> ✨ EL CORAZÓN DEL NUEVO DISEÑO DE INPUT (V3.1) ✨ <--- */
#zetai-input-wrapper {
  margin: 1rem;
  background-color: white;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  position: relative; /* Clave para posicionar el botón */
  display: flex;
  align-items: flex-end; /* Alinear items abajo */
  transition: all 0.2s ease;
  /* El padding se lo damos al textarea, no al wrapper */
}

#zetai-input-wrapper:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.zetai-textarea-style {
  flex-grow: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  resize: none;
  line-height: 1.5;
  max-height: 150px;
  overflow-y: auto;
  color: var(--color-text);
  padding: 0.75rem 3rem 0.75rem 1rem; /* Padding: Arriba, Derecha (para el botón), Abajo, Izquierda */
}
.zetai-textarea-style::-webkit-scrollbar { width: 4px; }
.zetai-textarea-style::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }


/* ---> ✨ EL NUEVO BOTÓN, INTEGRADO Y MINIMALISTA ✨ <--- */
.zetai-send-btn-style {
  position: absolute; /* Posicionado DENTRO del wrapper */
  right: 0.5rem;
  bottom: 0.5rem;
  height: 2.5rem;
  width: 2.5rem;
  flex-shrink: 0;
  border-radius: 0.75rem;
  /* ESTILO MINIMALISTA */
  background: transparent;
  color: var(--color-text-secondary); /* Color oscuro pero sutil */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
}
.zetai-send-btn-style:hover {
  background: var(--color-light-gray); /* Un feedback visual al pasar el cursor */
  color: var(--color-text); /* Se oscurece un poco más */
}
.zetai-send-btn-style:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
}

/* Burbujas de chat */
.zetai-bubble {
  padding: 0.75rem 1.25rem;
  border-radius: 1.25rem;
  max-width: 90%; /* Un poco más anchas */
  font-size: 0.95rem;
  line-height: 1.6;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  word-wrap: break-word;
}
.zetai-bubble p:first-child { margin-top: 0; }
.zetai-bubble p:last-child { margin-bottom: 0; }

.zetai-bubble.user {
  background-color: var(--color-primary);
  color: white;
  border-bottom-right-radius: 0.25rem;
  align-self: flex-end;
}

.zetai-bubble.ai {
  background-color: #E5E7EB;
  color: var(--color-text);
  border-bottom-left-radius: 0.25rem;
  align-self: flex-start;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.clearing-conversation {
  animation: fadeOutAndClear 0.5s ease-out forwards;
}
@keyframes fadeOutAndClear {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(20px); }
}


/* El botón para ABRIR el chat */
#zetai-open-btn {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  height: 4rem;
  width: 4rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
  pointer-events: all;
  transform: scale(0);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}
#zetai-chat-container.zetai-minimized #zetai-open-btn {
  transform: scale(1);
  opacity: 1;
}
#zetai-open-btn:hover {
    transform: scale(1.1);
}

/* Hint de introducción en el Dashboard */
#zetai-intro-hint {
    position: fixed;
    bottom: 6.5rem;
    right: 1.5rem;
    padding: 0.75rem 1.25rem;
    background: #2d3748;
    color: white;
    border-radius: 0.75rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease-out;
    z-index: 999;
    pointer-events: none;
}
#zetai-intro-hint.visible {
    opacity: 1;
    transform: translateY(0);
}
#zetai-intro-hint::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 2rem;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #2d3748;
}


/* ===== Animaciones de ZetAI ===== */
@keyframes fadeOutAndClear {
  from {
      opacity: 1;
      transform: translateY(0);
  }
  to {
      opacity: 0;
      transform: translateY(20px);
  }
}

.clearing-conversation {
  animation: fadeOutAndClear 0.5s ease-out forwards;
}

/* ======================================= */
/* ===== Estilos para el Widget Modal ===== */
/* ======================================= */
.widget-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  text-align: center;
  background-color: #f8f9fa;
  transition: all 0.2s ease-in-out;
}

.widget-option-btn:hover {
  border-color: var(--color-primary);
  background-color: white;
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* === NUEVAS CLASES PARA EL LAYOUT DE ZETAI.HTML === */

/* Este contenedor ocupa el espacio restante debajo del header */
.main-full-height {
  height: calc(100vh - var(--header-height));
  width: 100%;
}

/* Esta clase se aplica a los paneles que deben tener scroll interno */
.scrollable-panel {
  overflow-y: auto;
  overscroll-behavior: contain; /* Evita que el scroll se "filtre" al body */
}

/* === ESTILOS PARA MODALES PERSONALIZADOS === */
.custom-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  z-index: 50;
  width: 90%;
  max-width: 450px;
}