/* ============================================================
   STORY SYSTEM — WhatsApp / Instagram Style
   ============================================================ */

/* ---------- Genel Story Section ---------- */
.story-section {
    width: 100%;
    background: #111b21;
    padding: 10px 0 6px;
    border-bottom: 1px solid #2a3942;
    overflow: hidden;
}

/* ---------- Carousel Wrapper ---------- */
.story-carousel-wrapper {
    position: relative;
    overflow: hidden;
    padding: 0 12px;
}

.story-carousel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding-bottom: 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.story-carousel::-webkit-scrollbar {
    display: none;
}

/* ---------- Boş Durum ---------- */
.story-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 24px;
    color: #8696a0;
    font-size: 12px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    width: 100%;
}

.story-empty i {
    font-size: 22px;
    color: #2a3942;
}

/* ---------- Story Kart ---------- */
.story-card {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    position: relative;
    min-width: 62px;
    transition: opacity .2s;
}

.story-card:active {
    opacity: .75;
}

/* Avatar çemberi */
.story-avatar-ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 2.5px;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    box-shadow: 0 0 0 2px #111b21;
    transition: background .3s;
    flex-shrink: 0;
}

.story-card.viewed .story-avatar-ring {
    background: #2a3942;
}

.story-avatar-ring img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: #1a2930;
    border: 2px solid #111b21;
}

/* İsim etiketi */
.story-card-name {
    font-size: 11px;
    color: #e9edef;
    font-family: 'Segoe UI', system-ui, sans-serif;
    max-width: 62px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.story-card.viewed .story-card-name {
    color: #8696a0;
}

/* Kendi hikaye ekleme kartı */
.story-card.add-story .story-avatar-ring {
    background: #2a3942;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.story-card.add-story .story-avatar-ring::after {
    content: '+';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #25d366;
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    line-height: 18px;
    text-align: center;
    border: 2px solid #111b21;
    font-weight: 700;
}

/* Görüntüleme rozeti */
.story-view-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 2px;
    pointer-events: none;
}

/* Üç nokta menüsü (kart üstünde) */
.story-dots-menu {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.5);
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    z-index: 2;
}

.story-card:hover .story-dots-menu {
    display: flex;
}

.story-dots-dropdown {
    position: absolute;
    top: 28px;
    left: 0;
    background: #233138;
    border-radius: 8px;
    padding: 4px 0;
    min-width: 130px;
    box-shadow: 0 4px 18px rgba(0,0,0,.4);
    z-index: 10;
    font-size: 12px;
    color: #e9edef;
    font-family: 'Segoe UI', system-ui, sans-serif;
    display: none;
}

.story-dots-dropdown button {
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    background: none;
    border: none;
    color: #e9edef;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.story-dots-dropdown button:hover {
    background: #2a3942;
}

/* ============================================================
   STORY VIEWER MODAL
   ============================================================ */
#storyViewerModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, .92);
    align-items: center;
    justify-content: center;
}

#storyViewerModal.active,
#storyViewerModal[style*="display: block"],
#storyViewerModal[style*="display:block"] {
    display: flex !important;
}

/* ---------- İç kutu (telefon frame) ---------- */
.ig-story-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    max-height: 720px;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 60px rgba(0,0,0,.9);
}

/* ---------- Progress Bar ---------- */
#storyProgressBar {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 3px;
    z-index: 20;
}

.story-progress-segment {
    flex: 1;
    height: 2.5px;
    background: rgba(255,255,255,.3);
    border-radius: 2px;
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 2px;
    transition: width .1s linear;
}

.story-progress-fill.completed {
    width: 100% !important;
}

/* Loading animasyonu */
.story-progress-fill.loading {
    width: 20% !important;
    animation: storyLoading 1s ease-in-out infinite alternate;
}

@keyframes storyLoading {
    from { opacity: .4; }
    to   { opacity: 1; }
}

/* ---------- Header ---------- */
.ig-story-header {
    position: absolute;
    top: 22px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    z-index: 20;
}

.ig-story-header-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    flex-shrink: 0;
}

.ig-story-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ig-story-header-name {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Segoe UI', system-ui, sans-serif;
    text-shadow: 0 1px 4px rgba(0,0,0,.7);
}

.ig-story-header-time {
    color: rgba(255,255,255,.7);
    font-size: 11px;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Görüntülenme sayısı */
#storyViewerViews {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,.85);
    font-size: 12px;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Mute butonu */
.ig-story-mute-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background .2s;
    flex-shrink: 0;
}

.ig-story-mute-btn:hover {
    background: rgba(255,255,255,.25);
}

/* 3 nokta menüsü (viewer içinde) */
.ig-story-more-menu {
    position: relative;
    flex-shrink: 0;
}

.ig-story-more-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: background .2s;
}

.ig-story-more-btn:hover {
    background: rgba(255,255,255,.25);
}

#storyMenuDropdown {
    position: absolute;
    top: 38px;
    right: 0;
    background: #233138;
    border-radius: 10px;
    padding: 4px 0;
    min-width: 160px;
    box-shadow: 0 4px 20px rgba(0,0,0,.5);
    z-index: 30;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

#storyMenuDropdown button {
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    background: none;
    border: none;
    color: #e9edef;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background .15s;
}

#storyMenuDropdown button:hover {
    background: #2a3942;
}

/* Kapat butonu */
.ig-story-close-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background .2s;
    flex-shrink: 0;
}

.ig-story-close-btn:hover {
    background: rgba(255,255,255,.3);
}

/* ---------- Video ---------- */
#storyViewerVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

/* ---------- Navigasyon Alanları ---------- */
.ig-story-nav {
    position: absolute;
    top: 0;
    bottom: 80px;
    width: 40%;
    z-index: 15;
    cursor: pointer;
}

.ig-story-nav-prev { left: 0; }
.ig-story-nav-next { right: 0; }

/* ---------- Açıklama (Caption) ---------- */
#storyCaption {
    position: absolute;
    bottom: 80px;
    left: 0;
    right: 0;
    padding: 30px 16px 10px;
    background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 100%);
    z-index: 18;
}

#storyCaptionText {
    color: #fff;
    font-size: 13px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    text-shadow: 0 1px 3px rgba(0,0,0,.8);
    line-height: 1.5;
}

/* ---------- Footer ---------- */
.ig-story-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(to top, rgba(0,0,0,.6) 0%, transparent 100%);
    z-index: 20;
}

/* Yanıt input */
#storyReplyInput {
    flex: 1;
    background: rgba(255,255,255,.15);
    border: 1.5px solid rgba(255,255,255,.3);
    border-radius: 24px;
    padding: 9px 16px;
    color: #fff;
    font-size: 13px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    outline: none;
    transition: border-color .2s, background .2s;
}

#storyReplyInput::placeholder {
    color: rgba(255,255,255,.55);
}

#storyReplyInput:focus {
    background: rgba(255,255,255,.2);
    border-color: #25d366;
}

/* Footer ikonları */
.ig-story-footer-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, color .15s;
    flex-shrink: 0;
}

.ig-story-footer-btn:hover {
    transform: scale(1.15);
}

/* ---------- Toast Bildirim ---------- */
.ig-story-toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0,0,0,.82);
    color: #fff;
    font-size: 13px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    padding: 8px 18px;
    border-radius: 20px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .25s, transform .25s;
    z-index: 50;
    pointer-events: none;
}

.ig-story-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    .ig-story-content {
        border-radius: 0;
        max-height: 100vh;
    }
}
