/**
 * CCTRL CHILD THEME – CSS LAYER: INTERACTIVE HELPERS
 * Handle suggestion in WordPress: 'cctrl-interactions'
 *
 * PURPOSE
 * - Visual states + shells for JS-driven behaviors:
 *     * Modals
 *     * Image lightbox
 *     * Rating widgets
 *     * Like/Save toggles
 *
 * LAYERING (LOAD ORDER)
 * - Depends on:
 *     cctrl-core.css
 *     cctrl-layout.css
 *     cctrl-components.css
 *     cctrl-patterns.css
 * - Plugin overrides (assets-plugins/*.css) should normally depend on this
 *   layer so they see the final theme styling.
 *
 * RULES FOR FUTURE WORK (for humans + AI)
 * - Keep interactions declarative: use classes & data-attributes that JS can toggle.
 * - Do NOT hardcode JS logic here – only visual states (e.g. .is-open, .is-on).
 * - If you add a new JS-powered UI pattern, document the expected CSS API
 *   in a short comment above the selector block.
 */
/* ===================================================================
   7. INTERACTIVE HELPERS (MODAL, LIGHTBOX, RATING, LIKE/SAVE)
   ================================================================== */


/* 7.1 Generic modal */

.cctrl-modal,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 18, 0.55);
  opacity: 0;
  visibility: hidden;
  display: grid;
  place-items: center;
  padding: var(--space-3);
  z-index: 50;
  transition:
    opacity var(--transition-med),
    visibility var(--transition-med);
}

.cctrl-modal[aria-hidden="false"],
.modal-backdrop[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.cctrl-modal__dialog,
.modal {
  width: min(680px, 100%);
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
}

.cctrl-modal__header,
.cctrl-modal__footer,
.modal header,
.modal footer {
  padding: var(--space-3);
  border-bottom: 1px solid var(--outline);
}

.cctrl-modal__footer,
.modal footer {
  border-top: 1px solid var(--outline);
  border-bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.cctrl-modal__body,
.modal .content {
  padding: var(--space-3);
}


/* 7.2 Image lightbox backdrop */

.cctrl-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 18, 0.75);
  display: grid;
  place-items: center;
  padding: var(--space-3);
  opacity: 0;
  visibility: hidden;
  z-index: 60;
  transition:
    opacity var(--transition-med),
    visibility var(--transition-med);
}

.cctrl-lightbox-backdrop[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.cctrl-lightbox {
  max-width: 960px;
  width: 100%;
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.cctrl-lightbox__body {
  padding: var(--space-3);
  background: #000;
  display: grid;
  place-items: center;
}

.cctrl-lightbox__img {
  max-height: 70vh;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.cctrl-lightbox__caption {
  padding: var(--space-4) var(--space-5);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-elev);
  text-align: center;
  border-top: 1px solid var(--outline);
  line-height: 1.5;
  min-height: 44px; /* Säkerställ att caption alltid har plats */
  display: flex;
  align-items: center;
  justify-content: center;
}

.cctrl-lightbox__caption:empty,
.cctrl-lightbox__caption[style*="display: none"] {
  display: none !important; /* Dölj om tom eller explicit dold */
}

.cctrl-lightbox__caption > div {
  width: 100%;
  color: var(--text);
  font-size: inherit;
}

.cctrl-lightbox__close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  transition: background var(--transition-fast);
}

.cctrl-lightbox__close:hover {
  background: rgba(0, 0, 0, 0.75);
}

/* Dark mode support för lightbox */
html[data-theme="dark"] .cctrl-lightbox-backdrop {
  background: rgba(0, 0, 0, 0.9);
}

html[data-theme="dark"] .cctrl-lightbox {
  background: var(--bg-elev);
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .cctrl-lightbox__caption {
  background: var(--bg-elev);
  color: var(--text);
  border-top-color: rgba(255, 255, 255, 0.1);
}


/* 7.3 Rating-stjärnor (emoji-stil) */

.cctrl-rating {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.cctrl-rating__star {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--pitch-charcoal-100);
  transition:
    transform var(--transition-fast),
    color var(--transition-fast),
    filter var(--transition-fast);
}

.cctrl-rating__star::before {
  content: "⭐";
}

.cctrl-rating__star.is-active {
  color: var(--golden-morning-500);
}

.cctrl-rating__star:hover {
  transform: translateY(-1px);
  filter: saturate(1.1);
}


/* 7.4 Like / Save-pills */

.cctrl-like-toggle,
.cctrl-save-toggle {
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--bg-elev);
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  box-shadow: var(--shadow-soft);
  transition:
    background var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    border-color var(--transition-fast);
}

.cctrl-like-toggle .icon,
.cctrl-save-toggle .icon {
  font-size: 1.2rem;
}

.cctrl-like-toggle.is-on {
  background: var(--success-100);
  border-color: rgba(53, 184, 127, 0.5);
}

.cctrl-save-toggle.is-on {
  background: var(--lagoon-coral-100);
  border-color: rgba(226, 89, 69, 0.5);
}

.cctrl-like-toggle.is-on,
.cctrl-save-toggle.is-on {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

/* 7.8 Standard carousel med CCTRL cards */
/* Enkel, standard karusell utan specialeffekter */
.cctrl-carousel {
  /* Inga specialinställningar - låt Elementor/Swiper hantera allt */
  --e-n-carousel-swiper-slides-gap: var(--space-4);
}

/* Kort i karusellen använder standard .card-styling */
.cctrl-carousel .swiper-slide {
  height: auto;
  display: flex;
}

/* Säkerställ att .card fyller hela sliden */
.cctrl-carousel .swiper-slide > .card {
  width: 100%;
  height: 100%;
}

/* Navigation-knappar - Fluent UI styling */
.cctrl-carousel .elementor-swiper-button-next,
.cctrl-carousel .elementor-swiper-button-prev {
  width: 48px;
  height: 48px;
  border-radius: var(--fluent-radius-circular, 999px);
  background: #fff;
  color: var(--ink, #1c244b);
  border: 1px solid rgba(45, 47, 97, 0.2);
  box-shadow: 0 14px 30px rgba(20, 23, 58, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 
    transform var(--fluent-duration-fast, 180ms) var(--fluent-curve-easy-ease, ease),
    box-shadow var(--fluent-duration-fast, 180ms) var(--fluent-curve-easy-ease, ease),
    background var(--fluent-duration-fast, 180ms) var(--fluent-curve-easy-ease, ease);
  font-size: 1.2rem;
  z-index: 10;
}

.cctrl-carousel .elementor-swiper-button-next:hover,
.cctrl-carousel .elementor-swiper-button-prev:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(20, 23, 58, 0.25);
  background: #fff;
  color: var(--ink, #1c244b);
}

.cctrl-carousel .elementor-swiper-button-next:active,
.cctrl-carousel .elementor-swiper-button-prev:active {
  transform: translateY(0);
  box-shadow: 0 14px 30px rgba(20, 23, 58, 0.18);
}

.cctrl-carousel .elementor-swiper-button-next:focus-visible,
.cctrl-carousel .elementor-swiper-button-prev:focus-visible {
  outline: 2px solid var(--lav-500, #6264a7);
  outline-offset: 2px;
  box-shadow: 
    0 14px 30px rgba(20, 23, 58, 0.18),
    0 0 0 4px rgba(98, 100, 167, 0.2);
}

.cctrl-carousel .elementor-swiper-button-next[disabled],
.cctrl-carousel .elementor-swiper-button-prev[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Pagination - Fluent UI styling */
.cctrl-carousel .swiper-pagination {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.cctrl-carousel .swiper-pagination-bullet {
  width: 12px;
  height: 12px;
  border-radius: var(--fluent-radius-circular, 999px);
  border: 0;
  background: rgba(45, 47, 97, 0.3);
  padding: 0;
  cursor: pointer;
  transition: 
    transform var(--fluent-duration-fast, 160ms) var(--fluent-curve-easy-ease, ease),
    background var(--fluent-duration-fast, 160ms) var(--fluent-curve-easy-ease, ease);
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
  opacity: 1;
}

.cctrl-carousel .swiper-pagination-bullet-active {
  transform: scale(1.4);
  background: var(--lav-600, #6e72c9);
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
}

.cctrl-carousel .swiper-pagination-bullet:focus,
.cctrl-carousel .swiper-pagination-bullet:focus-visible,
.cctrl-carousel .swiper-pagination-bullet:active {
  outline: none;
  box-shadow: none !important;
}
