/* ========================================
   SERVICIOS MODERNOS - SMARTCLINIC
   ======================================== */

body {
  font-family: var(--font-primary);
  color: var(--color-text-primary);
  background: var(--color-off-white);
}

.container {
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-fluid {
  width: 100%;
  padding: 0;
}

/* ========================================
   LAYOUT DOS COLUMNAS
   ======================================== */
.services-layout {
  padding: 0;
  background: var(--color-off-white);
}

.services-layout__wrapper {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: calc(100vh - var(--header-height) - 200px);
  margin-top: calc(var(--header-height));
}

/* ========================================
   SIDEBAR - LISTA DE SERVICIOS
   ======================================== */
.services-sidebar {
  background: var(--color-white);
  border-right: 1px solid var(--color-light-gray);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

.services-sidebar__header {
  padding: var(--space-xl);
  border-bottom: 1px solid var(--color-light-gray);
  background: var(--color-white);
}

.services-sidebar__search {
  position: relative;
  margin-bottom: var(--space-md);
}

.services-sidebar__search-icon {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-medium-gray);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.services-sidebar__search-input {
  width: 100%;
  padding: var(--space-md) var(--space-3xl) var(--space-md) 2.75rem;
  border: 1px solid var(--color-light-gray);
  background: var(--color-off-white);
  font-size: var(--text-sm);
  transition: all var(--transition-base);
}

.services-sidebar__search-input:focus {
  border-color: var(--color-accent);
  background: var(--color-white);
  outline: none;
}

.services-sidebar__search-input:focus ~ .services-sidebar__search-icon {
  color: var(--color-accent);
}

.services-sidebar__search-clear {
  position: absolute;
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: var(--space-xs);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
  color: var(--color-medium-gray);
  display: flex;
  align-items: center;
  justify-content: center;
}

.services-sidebar__search-clear.active {
  opacity: 1;
  pointer-events: all;
}

.services-sidebar__search-clear:hover {
  color: var(--color-error);
}

.services-sidebar__count {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}

.services-sidebar__count span {
  color: var(--color-accent);
  font-weight: var(--weight-bold);
}

.services-sidebar__list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Scrollbar personalizado */
.services-sidebar__list::-webkit-scrollbar {
  width: 6px;
}

.services-sidebar__list::-webkit-scrollbar-track {
  background: transparent;
}

.services-sidebar__list::-webkit-scrollbar-thumb {
  background: var(--color-gray);
  transition: background var(--transition-fast);
}

.services-sidebar__list::-webkit-scrollbar-thumb:hover {
  background: var(--color-medium-gray);
}

/* Item de servicio */
.service-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-light-gray);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  opacity: 0;
  animation: slideInLeft 0.4s ease-out forwards;
}

.service-item:nth-child(1) {
  animation-delay: 0.05s;
}
.service-item:nth-child(2) {
  animation-delay: 0.1s;
}
.service-item:nth-child(3) {
  animation-delay: 0.15s;
}
.service-item:nth-child(4) {
  animation-delay: 0.2s;
}
.service-item:nth-child(5) {
  animation-delay: 0.25s;
}
.service-item:nth-child(6) {
  animation-delay: 0.3s;
}
.service-item:nth-child(7) {
  animation-delay: 0.35s;
}
.service-item:nth-child(8) {
  animation-delay: 0.4s;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.service-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--color-accent);
  transform: scaleY(0);
  transition: transform var(--transition-base);
}

.service-item:hover {
  background: var(--color-off-white);
  padding-left: calc(var(--space-xl) + var(--space-sm));
}

.service-item.active {
  background: var(--color-primary-lighter);
}

.service-item.active::before {
  transform: scaleY(1);
}

.service-item__image {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-light-gray);
}

.service-item__content {
  flex: 1;
  min-width: 0;
}

.service-item__title {
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: 2px;
  font-size: var(--text-base);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition-fast);
}

.service-item.active .service-item__title {
  color: var(--color-primary);
}

.service-item__subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-item__arrow {
  color: var(--color-medium-gray);
  flex-shrink: 0;
  transition: all var(--transition-fast);
  opacity: 0;
}

.service-item:hover .service-item__arrow,
.service-item.active .service-item__arrow {
  opacity: 1;
  transform: translateX(4px);
}

.service-item.active .service-item__arrow {
  color: var(--color-accent);
}

/* ========================================
   PANEL DE DETALLES
   ======================================== */
.services-detail {
  position: relative;
  background: var(--color-off-white);
  padding: var(--space-3xl);
  overflow-y: auto;
  height: calc(100vh - var(--header-height));
}

.services-detail::-webkit-scrollbar {
  width: 8px;
}

.services-detail::-webkit-scrollbar-track {
  background: var(--color-light-gray);
}

.services-detail::-webkit-scrollbar-thumb {
  background: var(--color-gray);
}

.services-detail::-webkit-scrollbar-thumb:hover {
  background: var(--color-medium-gray);
}

/* Estado vacío */
.services-detail__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  opacity: 1;
  transition: opacity var(--transition-base);
}

.services-detail__empty.hidden {
  display: none;
}

.services-detail__empty-icon {
  margin-bottom: var(--space-2xl);
  color: var(--color-gray);
  opacity: 0.5;
}

.services-detail__empty h3 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.services-detail__empty p {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
}

/* Contenido del detalle */
.services-detail__content {
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition-slow);
  display: none;
}

.services-detail__content.active {
  opacity: 1;
  transform: translateY(0);
  display: block;
}

.services-detail__header {
  margin-bottom: var(--space-2xl);
  animation: fadeInUp 0.6s ease-out;
}

.services-detail__image-wrapper {
  position: relative;
  width: 100%;
  height: 350px;
  margin-bottom: var(--space-2xl);
  overflow: hidden;
  background: var(--color-light-gray);
  animation: fadeIn 0.8s ease-out;
}

.services-detail__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slower);
}

/* Posición específica para ciertas imágenes */
.services-detail__image[alt="Cirugía General y Menor"],
.services-detail__image[alt="Medicina General"],
.services-detail__image[alt="Laboratorio Clínico"],
.services-detail__image[alt="Nutrición y Dietética"] {
  object-position: bottom;
}

.services-detail__content.active .services-detail__image {
  animation: zoomIn 0.8s ease-out;
}

@keyframes zoomIn {
  from {
    transform: scale(1.1);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.services-detail__badge {
  position: absolute;
  top: var(--space-lg);
  left: var(--space-lg);
  padding: var(--space-sm) var(--space-lg);
  background: var(--color-accent);
  color: var(--color-white);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: slideInRight 0.6s ease-out 0.3s backwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.services-detail__title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-lg);
  line-height: 1.2;
  animation: fadeInUp 0.6s ease-out 0.2s backwards;
}

.services-detail__description {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  line-height: 1.8;
  margin-bottom: var(--space-3xl);
  animation: fadeInUp 0.6s ease-out 0.3s backwards;
}

.services-detail__section {
  background: var(--color-white);
  padding: var(--space-2xl);
  margin-bottom: var(--space-xl);
  border-left: 3px solid var(--color-accent);
  animation: fadeInUp 0.6s ease-out 0.4s backwards;
}

.services-detail__section-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text-primary);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.services-detail__section-icon {
  width: 32px;
  height: 32px;
  background: var(--color-primary-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.services-detail__benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
}

.services-detail__benefit {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-off-white);
  transition: all var(--transition-base);
  opacity: 0;
  animation: fadeInScale 0.5s ease-out forwards;
}

.services-detail__benefit:nth-child(1) {
  animation-delay: 0.5s;
}
.services-detail__benefit:nth-child(2) {
  animation-delay: 0.6s;
}
.services-detail__benefit:nth-child(3) {
  animation-delay: 0.7s;
}
.services-detail__benefit:nth-child(4) {
  animation-delay: 0.8s;
}
.services-detail__benefit:nth-child(5) {
  animation-delay: 0.9s;
}
.services-detail__benefit:nth-child(6) {
  animation-delay: 1s;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.services-detail__benefit:hover {
  background: var(--color-primary-lighter);
  transform: translateY(-2px);
}

.services-detail__benefit-icon {
  width: 24px;
  height: 24px;
  background: var(--color-accent);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.services-detail__benefit-text {
  flex: 1;
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* ========================================
   CTA MODERNO
   ======================================== */
.services-cta-modern {
  background: var(--color-primary);
  padding: var(--space-5xl) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.services-cta-modern::before {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(
    circle,
    rgba(0, 122, 107, 0.3) 0%,
    transparent 70%
  );
  top: -250px;
  right: -250px;
  animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

.services-cta-modern__content {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
}

.services-cta-modern__content h2 {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  color: var(--color-white);
  margin-bottom: var(--space-lg);
}

.services-cta-modern__content p {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-2xl);
}

.btn-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-2xl);
  font-weight: var(--weight-medium);
  font-size: var(--text-base);
  text-decoration: none;
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
}

.btn-modern--primary {
  background: var(--color-accent);
  color: var(--color-white);
}

.btn-modern--primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 122, 107, 0.3);
}

/* ========================================
   WHATSAPP WIDGET (MANTENER ORIGINAL)
   ======================================== */
.whatsapp-widget {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-fixed);
  transition: opacity var(--transition-base), transform var(--transition-base),
    visibility var(--transition-base);
  opacity: 1;
  transform: scale(1);
  visibility: visible;
}

.whatsapp-widget.hidden {
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  visibility: hidden;
  pointer-events: none;
}

.whatsapp-widget__button {
  width: 60px;
  height: 60px;
  background: #25d366;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xl);
  transition: all var(--transition-base);
  border-radius: 50%;
}

.whatsapp-widget__button:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
}

.whatsapp-widget__button svg {
  width: 32px;
  height: 32px;
}

.whatsapp-widget__badge {
  position: absolute;
  top: -25px;
  right: -10px;
  background: #128c7e;
  color: white;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  white-space: nowrap;
  border-radius: 12px;
  opacity: 0;
  animation: badgePulse 1s ease-out 2s forwards,
    pulseBadge 1.2s ease-in-out 3s infinite;
}

@keyframes badgePulse {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulseBadge {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.whatsapp-modal {
  position: fixed;
  bottom: var(--space-5xl);
  right: var(--space-xl);
  width: 320px;
  background: white;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  pointer-events: none;
  transition: all var(--transition-base);
  background-image: url("../../assets/extras/fondo-ws.webp");
  background-size: contain;
  background-position: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.whatsapp-modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.85);
  z-index: 1;
  pointer-events: none;
}

.whatsapp-modal.active {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

.whatsapp-modal__header {
  background: #075e54;
  color: white;
  padding: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
}

.whatsapp-modal__header h3 {
  margin: 0;
  font-size: var(--text-lg);
}

.whatsapp-modal__close {
  background: none;
  border: none;
  color: white;
  font-size: var(--text-3xl);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.whatsapp-modal__body {
  padding: var(--space-lg);
  min-height: 150px;
  position: relative;
  z-index: 2;
}

.whatsapp-modal__message {
  background: #dcf8c6;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  animation: typingAnimation 0.5s ease-out;
  position: relative;
  z-index: 2;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.whatsapp-modal__message::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 10px 10px;
  border-color: transparent transparent #dcf8c6 transparent;
}

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

.whatsapp-modal__message p {
  margin-bottom: var(--space-sm);
  color: #303030;
  font-size: var(--text-sm);
}

.whatsapp-modal__message p:last-child {
  margin-bottom: 0;
}

.whatsapp-modal__footer {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  position: relative;
  z-index: 2;
}

.whatsapp-modal__input {
  width: 100%;
  height: auto;
  padding: var(--space-md);
  border: 1px solid var(--color-gray);
  border-radius: 8px;
  font-size: var(--text-sm);
  background-color: #f0f0f0;
  color: var(--color-text-primary);
  overflow-y: auto;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.whatsapp-modal__footer .btn {
  width: 100%;
  padding: var(--space-md);
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
  font-family: var(--font-primary);
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-white);
}

.btn--primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
  .services-layout__wrapper {
    grid-template-columns: 320px 1fr;
  }

  .services-detail {
    padding: var(--space-2xl);
  }

  .services-detail__title {
    font-size: var(--text-3xl);
  }

  .services-detail__image-wrapper {
    height: 280px;
  }
}

@media (max-width: 768px) {
  .services-layout__wrapper {
    grid-template-columns: 1fr;
    min-height: auto;
    margin-top: 60px;
  }

  .services-sidebar {
    position: relative;
    top: 0;
    height: auto;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--color-light-gray);
  }

  .services-sidebar__header {
    padding: var(--space-md);
  }

  .services-sidebar__search-input {
    padding: 10px 2.5rem 10px 2.5rem;
    font-size: 13px;
  }

  .services-sidebar__count {
    font-size: 12px;
  }

  .service-item {
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
  }

  .service-item__image {
    width: 40px;
    height: 40px;
  }

  .service-item__title {
    font-size: var(--text-sm);
  }

  .service-item__subtitle {
    font-size: 11px;
  }

  .services-detail {
    height: auto;
    padding: var(--space-lg) var(--space-md);
    min-height: auto;
  }

  .services-detail__image-wrapper {
    height: 180px;
    margin-bottom: var(--space-lg);
  }

  .services-detail__badge {
    top: var(--space-sm);
    left: var(--space-sm);
    padding: 6px var(--space-sm);
    font-size: 10px;
  }

  .services-detail__title {
    font-size: var(--text-lg);
    margin-bottom: var(--space-sm);
  }

  .services-detail__description {
    font-size: var(--text-sm);
    line-height: 1.6;
    margin-bottom: var(--space-lg);
  }

  .services-detail__section {
    padding: var(--space-md);
    margin-bottom: var(--space-md);
  }

  .services-detail__section-title {
    font-size: var(--text-base);
    margin-bottom: var(--space-sm);
    gap: var(--space-sm);
  }

  .services-detail__section-icon {
    width: 28px;
    height: 28px;
  }

  .services-detail__benefits-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
  }

  .services-detail__benefit {
    padding: 10px;
    gap: 10px;
  }

  .services-detail__benefit-icon {
    width: 20px;
    height: 20px;
  }

  .services-detail__benefit-text {
    font-size: 12px;
    line-height: 1.5;
  }

  .services-detail__empty-icon {
    margin-bottom: var(--space-lg);
  }

  .services-detail__empty h3 {
    font-size: var(--text-lg);
    margin-bottom: 6px;
  }

  .services-detail__empty p {
    font-size: var(--text-sm);
  }

  .services-cta-modern {
    padding: var(--space-2xl) 0;
  }

  .services-cta-modern__content h2 {
    font-size: var(--text-xl);
  }

  .services-cta-modern__content p {
    font-size: var(--text-sm);
    margin-bottom: var(--space-lg);
  }

  .btn-modern {
    padding: 10px var(--space-lg);
    font-size: 13px;
  }

  .whatsapp-widget {
    bottom: var(--space-md);
    right: var(--space-md);
  }

  .whatsapp-widget__button {
    width: 50px;
    height: 50px;
  }

  .whatsapp-widget__button svg {
    width: 26px;
    height: 26px;
  }

  .whatsapp-modal {
    width: calc(100% - var(--space-lg) * 2);
    right: var(--space-md);
    bottom: 70px;
  }
}
