/* ===== CSS VARIABLES ===== */
:root {
  --olive-50:  #f6f7f0;
  --olive-100: #eaeddb;
  --olive-200: #d4dab8;
  --olive-300: #b7c289;
  --olive-400: #99a85f;
  --olive-500: #7a8d42;
  --olive-600: #5e6e30;
  --olive-700: #495628;
  --olive-800: #3b4522;
  --olive-900: #323b1e;
  --olive-950: #191f0d;
  --cream: #faf8f3;
  --sand: #e8e0cc;
}

/* ===== BASE ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background-color: var(--cream); color: var(--olive-900); }

/* ===== TYPOGRAPHY ===== */
.font-700 { font-weight: 700; }

/* ===== TEXT GRADIENT ===== */
.text-gradient {
  background: linear-gradient(135deg, var(--olive-500) 0%, var(--olive-300) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--olive-600), var(--olive-800));
  color: white;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(94, 110, 48, 0.35);
}

.btn-secondary {
  background: white;
  color: var(--olive-700);
  border: 2px solid var(--olive-200);
  transition: all 0.3s ease;
}
.btn-secondary:hover {
  border-color: var(--olive-400);
  background: var(--olive-50);
  transform: translateY(-2px);
}

.btn-white {
  background: white;
  color: var(--olive-800);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-white:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}

.btn-outline-white {
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.4);
  transition: all 0.3s ease;
}
.btn-outline-white:hover {
  background: rgba(255,255,255,0.1);
  border-color: white;
}

/* ===== HEADER ===== */
#header {
  background: transparent;
}
#header.scrolled {
  background: rgba(250, 248, 243, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 24px rgba(50,59,30,0.08);
}

/* ===== HERO ===== */
.hero-pattern {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(122, 141, 66, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(183, 194, 137, 0.1) 0%, transparent 40%),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 40px,
      rgba(122,141,66,0.02) 40px,
      rgba(122,141,66,0.02) 80px
    );
}

/* ===== BLOBS ===== */
.blob {
  position: absolute;
  border-radius: 9999px;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
  animation: blob-float 8s ease-in-out infinite;
}
.blob-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(122,141,66,0.18), transparent 70%);
  top: -100px; left: -150px;
  animation-delay: 0s;
}
.blob-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(183,194,137,0.15), transparent 70%);
  bottom: -50px; right: -100px;
  animation-delay: -3s;
}
.blob-3 {
  width: 600px; height: 400px;
  background: radial-gradient(circle, rgba(122,141,66,0.08), transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -2s;
}
.blob-4 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(122,141,66,0.1), transparent 70%);
  top: 0; right: -100px;
  animation-delay: -4s;
}
.blob-5 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(183,194,137,0.12), transparent 70%);
  bottom: 0; left: -100px;
}
.blob-dark {
  width: 600px; height: 500px;
  background: radial-gradient(circle, rgba(94,110,48,0.25), transparent 70%);
  top: -100px; right: -100px;
  opacity: 0.6;
  animation-delay: -1.5s;
}

@keyframes blob-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

/* ===== HERO IMAGE ===== */
.hero-image-wrap { position: relative; }
.hero-image { object-position: center top; }

.floating-card, .floating-card-2 {
  animation: float-card 4s ease-in-out infinite;
}
.floating-card-2 {
  animation-delay: -2s;
}
@keyframes float-card {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ===== STAT CARDS ===== */
.stat-card {
  background: white;
  border: 1px solid var(--olive-100);
  box-shadow: 0 4px 20px rgba(50,59,30,0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(50,59,30,0.1);
}

/* ===== SCROLL INDICATOR ===== */
.scroll-indicator { animation: fade-bounce 2s ease-in-out infinite; }
@keyframes fade-bounce {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
  50% { opacity: 0.9; transform: translateX(-50%) translateY(6px); }
}
.scroll-dot { animation: scroll-dot 2s ease-in-out infinite; }
@keyframes scroll-dot {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(14px); opacity: 0; }
}

/* ===== SECTION LABELS ===== */
.section-label {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 9999px;
  background: var(--olive-100);
  color: var(--olive-700);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.section-label-light {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 9999px;
  background: rgba(122,141,66,0.2);
  color: var(--olive-300);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.section-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  color: var(--olive-900);
}
.section-subtitle {
  color: var(--olive-600);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
}

/* ===== SERVICE CARDS ===== */
.service-card {
  background: white;
  border: 1px solid var(--olive-100);
  box-shadow: 0 4px 24px rgba(50,59,30,0.05);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation-delay: var(--delay, 0s);
}
.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 48px rgba(94,110,48,0.15);
  border-color: var(--olive-200);
}
.service-icon-wrap {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--olive-100), var(--olive-50));
  display: flex; align-items: center; justify-content: center;
  color: var(--olive-600);
  transition: all 0.3s ease;
}
.service-card:hover .service-icon-wrap {
  background: linear-gradient(135deg, var(--olive-600), var(--olive-800));
  color: white;
}

/* ===== NOSOTROS ===== */
.about-stat-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}

.doctor-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
}
.doctor-image-overlay {
  background: linear-gradient(to top, rgba(25,31,13,0.8) 0%, transparent 50%);
}
.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(122,141,66,0.2);
  color: var(--olive-300);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ===== TESTIMONIALS ===== */
.testimonial-card {
  background: white;
  border: 1px solid var(--olive-100);
  box-shadow: 0 4px 24px rgba(50,59,30,0.06);
  transition: all 0.3s ease;
  animation-delay: var(--delay, 0s);
}
.testimonial-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(50,59,30,0.1);
}

.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--olive-500), var(--olive-700));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ===== GALLERY ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 768px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

.gallery-item {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4/3;
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.gallery-item:hover img { transform: scale(1.06); }

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(25,31,13,0.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gallery-item:hover .gallery-overlay { opacity: 1; }

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
}
.lightbox.active { display: flex; }

.lightbox-content {
  max-width: min(90vw, 900px);
  max-height: 85vh;
  border-radius: 12px;
  overflow: hidden;
}
.lightbox-content img {
  max-width: 100%; max-height: 85vh;
  object-fit: contain;
  border-radius: 12px;
  display: block;
}

.lightbox-close {
  position: absolute; top: 20px; right: 20px;
  color: white; background: rgba(255,255,255,0.15);
  border: none; cursor: pointer;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

.lightbox-nav {
  position: absolute;
  color: white; background: rgba(255,255,255,0.15);
  border: none; cursor: pointer;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  top: 50%; transform: translateY(-50%);
}
.lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* ===== CTA SECTION ===== */
.cta-section {
  background: linear-gradient(135deg, var(--olive-800) 0%, var(--olive-950) 100%);
}
.cta-section::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(122,141,66,0.2) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 50%, rgba(183,194,137,0.1) 0%, transparent 50%);
}

/* ===== CONTACT FORM ===== */
.contact-form {
  background: white;
  border: 1px solid var(--olive-100);
  box-shadow: 0 8px 40px rgba(50,59,30,0.08);
}
.form-input {
  background: var(--olive-50);
  border: 1.5px solid var(--olive-100);
  font-family: 'Lexend', sans-serif;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--olive-500);
  box-shadow: 0 0 0 3px rgba(122,141,66,0.12);
}

.contact-info-card {
  background: white;
  border: 1px solid var(--olive-100);
  box-shadow: 0 2px 16px rgba(50,59,30,0.05);
  transition: transform 0.3s ease;
}
.contact-info-card:hover { transform: translateX(4px); }
.contact-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 12px;
  background: var(--olive-100);
  display: flex; align-items: center; justify-content: center;
  color: var(--olive-600);
}

/* ===== REVEAL ANIMATIONS ===== */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: var(--delay, 0s);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== CHAT WIDGET ===== */
.chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.chat-toggle {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--olive-600), var(--olive-800));
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 32px rgba(94,110,48,0.4);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  animation: pulse-chat 2.5s ease-in-out infinite;
  position: relative;
}
.chat-toggle:hover { transform: scale(1.1); animation: none; }
.chat-widget.open .chat-toggle { animation: none; }

@keyframes pulse-chat {
  0%, 100% { box-shadow: 0 8px 32px rgba(94,110,48,0.4), 0 0 0 0 rgba(94,110,48,0.4); }
  50% { box-shadow: 0 8px 32px rgba(94,110,48,0.4), 0 0 0 14px rgba(94,110,48,0); }
}

.chat-tooltip {
  background: white;
  color: var(--olive-800);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: 'Lexend', sans-serif;
  box-shadow: 0 4px 20px rgba(50,59,30,0.15);
  border: 1px solid var(--olive-100);
  white-space: nowrap;
  transition: opacity 0.3s, transform 0.3s;
  transform-origin: bottom right;
}
.chat-widget.open .chat-tooltip {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.chat-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 340px;
  max-height: 480px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 16px 64px rgba(50,59,30,0.2);
  border: 1px solid var(--olive-100);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: scale(0.9) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.chat-widget.open .chat-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--olive-600), var(--olive-800));
  color: white;
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Bricolage Grotesque', sans-serif;
}
.chat-header button {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.8); padding: 4px;
  transition: color 0.2s;
}
.chat-header button:hover { color: white; }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--olive-200); border-radius: 4px; }

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.82rem;
  line-height: 1.5;
  font-family: 'Lexend', sans-serif;
}
.chat-msg.user {
  background: linear-gradient(135deg, var(--olive-600), var(--olive-800));
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  background: var(--olive-50);
  color: var(--olive-800);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--olive-100);
}
.chat-msg.assistant a {
  color: var(--olive-600);
  text-decoration: underline;
}
.chat-msg.typing {
  background: var(--olive-50);
  border: 1px solid var(--olive-100);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.typing-dots {
  display: flex; gap: 4px; align-items: center;
  padding: 2px 0;
}
.typing-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--olive-400);
  animation: typing-dot 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-input-area {
  display: flex; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--olive-100);
  background: white;
}
.chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--olive-100);
  background: var(--olive-50);
  font-family: 'Lexend', sans-serif;
  font-size: 0.82rem;
  color: var(--olive-900);
  outline: none;
  transition: border-color 0.2s;
}
.chat-input-area input:focus { border-color: var(--olive-500); }
.chat-input-area button {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--olive-600), var(--olive-800));
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.chat-input-area button:hover { transform: scale(1.08); }

/* ===== ICON TOGGLE ===== */
.icon-open, .icon-close { transition: all 0.2s; }
.hidden { display: none; }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 640px) {
  .chat-panel { width: calc(100vw - 40px); right: 0; }
  .lightbox-nav { width: 40px; height: 40px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}
