@font-face {
  font-family: "howiyafont";
  src: url("../fonts/jf.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

/* ── Wrapper ── */
.howiya-stories-wrapper {
  position: relative;
  margin: 30px 0;
  font-family: "howiyafont", sans-serif;
}

/* ── Widget Title ── */
.howiya-stories-wrapper .widget-header {
  margin-bottom: 20px;
  text-align: center;
}

.howiya-stories-wrapper .widget-header .widget-title {
  font-size: 1.8rem;
  font-weight: 700;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: #fff;
  background: var(--dt-main-color, #1151d3);
  padding: 7px 14px;
  line-height: 1.2;
  margin: 0;
  position: relative;
}

.howiya-stories-wrapper .widget-header .widget-title::after {
  display: none;
}

.howiya-stories-wrapper .widget-header .widget-title::before {
  content: "\f061";
  display: inline-block;
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  transform: rotate(-45deg);
  width: 1.6rem;
  height: 1.6rem;
  line-height: 1.6rem;
}

.rtl .howiya-stories-wrapper .widget-header .widget-title::before {
  transform: rotate(45deg) scaleX(-1);
}

/* ── Carousel ── */
.howiya-stories-carousel {
  display: flex;
  align-items: center;
  gap: 4px;
}

.howiya-stories-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 8px 4px;
  flex: 1;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.howiya-stories-track::-webkit-scrollbar {
  display: none;
}

/* ── Story Card ── */
.howiya-story-item {
  flex: 0 0 auto;
  cursor: pointer;
  width: 160px;
  transition: transform 0.2s ease;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.howiya-story-item:hover {
  transform: translateY(-3px);
}

.howiya-story-card {
  width: 160px;
  height: 288px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.2s;
  background: #1a1a2e;
}

.howiya-story-item:hover .howiya-story-card {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.howiya-story-card-img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  max-width: none !important;
  max-height: none !important;
  vertical-align: top !important;
}

.howiya-story-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.65) 100%);
  display: flex;
  align-items: flex-end;
  padding: 12px;
  z-index: 1;
  pointer-events: none;
}

.howiya-story-card-title {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  word-wrap: break-word;
}

/* ── Carousel Nav Buttons ── */
.howiya-stories-nav {
  background: var(--dt-main-color, #1151d3);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  min-width: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  transition: opacity 0.2s;
  z-index: 10;
  opacity: 0.9;
  line-height: 1;
  padding: 0;
  margin: 0;
}

.howiya-stories-nav i {
  font-size: 1.1rem;
  line-height: 1;
  color: #fff;
}

.howiya-stories-nav:hover {
  opacity: 1;
}

/* ── Video Viewer ── */
.howiya-story-viewer {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 999999 !important;
  background: rgba(0, 0, 0, 0.92);
  overflow: hidden;
}

.howiya-story-viewer.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.howiya-story-viewer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.howiya-story-viewer-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
  overflow: hidden;
}

.howiya-story-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.howiya-story-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.howiya-story-video-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 90vh;
  max-height: 90vh;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.howiya-story-video-wrap iframe,
.howiya-story-video-wrap video,
.howiya-story-video-wrap embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 1;
}

/* ── Viewer Nav Buttons ── */
.howiya-story-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 0;
  line-height: 1;
}

.howiya-story-nav i {
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
}

.howiya-story-nav:hover {
  background: rgba(255, 255, 255, 0.35);
}

.howiya-story-prev {
  left: 16px;
}
.howiya-story-next {
  right: 16px;
}

/* ── RTL ── */
.rtl .howiya-stories-carousel {
  flex-direction: row-reverse;
}
.rtl .howiya-story-close {
  right: auto;
  left: 16px;
}
.rtl .howiya-story-prev {
  left: auto;
  right: 16px;
}
.rtl .howiya-story-next {
  right: auto;
  left: 16px;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .howiya-story-item {
    width: 120px;
  }
  .howiya-story-card {
    width: 120px;
    height: 200px;
  }
  .howiya-story-viewer-container {
    flex-direction: column;
    justify-content: center;
    padding: 0;
  }
  .howiya-story-video-wrap {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
  }
  .howiya-story-nav {
    width: 44px;
    height: 44px;
  }
  .howiya-story-prev {
    left: 8px;
  }
  .howiya-story-next {
    right: 8px;
  }
  .howiya-story-close {
    top: 8px;
    right: 8px;
    z-index: 20;
  }
  .howiya-stories-nav {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }
}

@media (max-width: 380px) {
  .howiya-story-item {
    width: 110px;
  }
  .howiya-story-card {
    width: 110px;
    height: 180px;
  }
  .howiya-stories-nav {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }
  .howiya-stories-nav i {
    font-size: 0.7rem;
  }
}

.howiya-stories-prev::before {
  content: "›";
  font-size: 24px;
  color: #fff;
  font-weight: bold;
}
.howiya-stories-next::before {
  content: "‹";
  font-size: 24px;
  color: #fff;
  font-weight: bold;
}
