/**
 * Insta Stories Widget for Elementor
 * Frontend CSS v1.0.1 — Hantema Developer
 */

.isw-stories-widget {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}

/* Track — gap inline style'dan gelir */
.isw-stories-track {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    align-items: flex-start;
}
.isw-stories-track::-webkit-scrollbar { display: none; }

/* Story item */
.isw-story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease;
}
.isw-story-item:hover  { transform: scale(1.05); }
.isw-story-item:active { transform: scale(0.97); }

/* Avatar ring */
.isw-story-avatar-wrap {
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    transition: background 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
}
.isw-story-avatar-wrap.seen {
    background: #c7c7c7 !important;
    box-shadow: none;
}

.isw-story-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: #efefef;
    position: relative;
}
.isw-story-avatar-inner img,
.isw-story-avatar-inner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Video badge */
.isw-video-badge {
    position: absolute;
    bottom: 2px; right: 2px;
    width: 18px; height: 18px;
    background: rgba(0,0,0,0.65);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #fff;
}
.isw-video-badge svg { width: 9px; height: 9px; fill: #fff; margin-left: 1px; }

/* Label */
.isw-story-label {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ════════════════════════════════
   VIEWER
   ════════════════════════════════ */
.isw-viewer-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.88);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    animation: iswFadeIn 0.2s ease;
}
.isw-viewer-overlay.active { display: flex; }

@keyframes iswFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Container — flex column: progress → header → media */
.isw-viewer-container {
    position: relative;
    width: 100%;
    max-width: 390px;
    height: calc(100vh - 60px);
    max-height: 680px;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    animation: iswSlideUp 0.22s ease;
}
@keyframes iswSlideUp {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@media (max-width: 767px) {
    .isw-viewer-container {
        max-width: 100%;
        border-radius: 0;
        height: 100vh;
        max-height: 100vh;
    }
}

/* ── Progress (flex item 1) ── */
.isw-viewer-progress-bar-wrap {
    display: flex;
    gap: 3px;
    padding: 10px 10px 6px;
    flex-shrink: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.45) 0%, transparent 100%);
    position: relative;
    z-index: 2;
}
.isw-viewer-progress-seg {
    height: 2px;
    flex: 1;
    background: rgba(255,255,255,0.38);
    border-radius: 2px;
    overflow: hidden;
}
.isw-viewer-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 2px;
}
.isw-viewer-progress-seg.done .isw-viewer-progress-fill {
    width: 100% !important;
    transition: none !important;
}

/* ── Header (flex item 2) ── */
.isw-viewer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 14px 10px;
    flex-shrink: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, transparent 100%);
    position: relative;
    z-index: 2;
}
.isw-viewer-header-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.75);
    flex-shrink: 0;
    background: #333;
}
.isw-viewer-header-avatar img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.isw-viewer-header-name {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.isw-viewer-close {
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    background: none;
    border: none;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    opacity: 0.9;
    transition: opacity 0.2s;
}
.isw-viewer-close:hover { opacity: 1; }

/* ── Media (flex item 3 — tüm kalan alan) ── */
.isw-viewer-media {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.isw-viewer-media img,
.isw-viewer-media video {
    position: relative;
    z-index: 1;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ── Touch zones (mobil, media içinde) ── */
.isw-viewer-touch-zones {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    z-index: 5;
}
@media (max-width: 767px) {
    .isw-viewer-touch-zones { display: flex; }
}
.isw-viewer-touch-left, .isw-viewer-touch-right { flex: 1; cursor: pointer; }

/* ── Desktop ok tuşları (media içinde) ── */
.isw-viewer-nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    padding: 0 8px;
    z-index: 6;
    box-sizing: border-box;
}
.isw-viewer-nav-btn {
    pointer-events: all;
    background: rgba(255,255,255,0.18);
    border: none;
    color: #fff;
    width: 36px; height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.2s;
}
.isw-viewer-nav-btn:hover { background: rgba(255,255,255,0.32); }
@media (max-width: 767px) { .isw-viewer-nav { display: none; } }

/* Elementor editor compat */
.elementor-editor-active .isw-viewer-overlay { pointer-events: none; }
