/* Components: store story management modal */

.story-modal-content {
    padding: 0;
    background: #0a0a0d;
    min-height: 100%;
}

#storeStoryModal {
    background: #0a0a0d;
}

#storeStoryModal .fullscreen-modal-header {
    display: none;
}

#storeStoryModal .fullscreen-modal-title {
    display: none;
}

#storeStoryModal .back-button {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.story-editor-stage {
    height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    background: #000;
}

.story-inline-back-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 9;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.story-preview-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-radius: 0;
    background: #000;
    isolation: isolate;
}

.story-upload-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 24px;
    color: #fff;
    background: rgba(0, 0, 0, 0.56);
    pointer-events: auto;
}

.story-upload-overlay.hidden {
    display: none;
}

.story-upload-progress-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(220px, 78vw);
    text-align: center;
}

.story-upload-ring {
    position: relative;
    width: 96px;
    height: 96px;
}

.story-upload-ring svg {
    display: block;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    overflow: visible;
}

.story-upload-ring-track,
.story-upload-ring-value {
    fill: none;
    stroke-width: 7;
}

.story-upload-ring-track {
    stroke: rgba(255, 255, 255, 0.2);
}

.story-upload-ring-value {
    stroke: #fff;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

.story-upload-ring-content {
    position: absolute;
    inset: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.story-upload-ring-content strong {
    font-size: 20px;
    line-height: 1;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.story-upload-progress-card p {
    margin: 0;
    min-height: 24px;
    font-size: 13px;
    line-height: 1.7;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.94);
}

#storeStoryModal.is-story-uploading .story-bottom-tools,
#storeStoryModal.is-story-uploading .story-actions-row,
#storeStoryModal.is-story-uploading .story-progress-bar-wrap,
#storeStoryModal.is-story-uploading .story-viewer-meta,
#storeStoryModal.is-story-uploading .story-inline-back-btn {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .story-upload-ring-value { transition: none; }
}

.story-viewer-loading {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #fff;
    background: #000;
    pointer-events: none;
}

.story-viewer-loading[hidden] {
    display: none;
}

.story-viewer-loading-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: story-viewer-loading-spin 0.8s linear infinite;
}

.story-viewer-loading-text {
    font-size: 13px;
    font-weight: 600;
}

@keyframes story-viewer-loading-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .story-viewer-loading-spinner {
        animation-duration: 1.6s;
    }
}

.story-preview-placeholder {
    min-height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #8b909a;
    font-size: 15px;
    text-align: center;
    padding: 24px;
}

.story-preview-placeholder i {
    font-size: 38px;
    opacity: 0.72;
}

.story-preview-media {
    width: 100%;
    display: block;
    height: 100%;
    object-fit: contain;
    background: #000;
    max-height: none;
}

.story-preview-video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
    z-index: 1;
    position: relative;
    visibility: visible;
    opacity: 1;
    border: 0;
    pointer-events: auto;
}

.story-preview-video::-webkit-media-controls {
    display: none !important;
}

.story-preview-video::-webkit-media-controls-enclosure {
    display: none !important;
}

.story-preview-video::-webkit-media-controls-start-playback-button {
    display: none !important;
}

.story-preview-video::cue {
    display: none;
}

video.story-preview-media {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.story-viewer-meta {
    position: absolute;
    top: 22px;
    right: 12px;
    left: 56px;
    z-index: 10;
    display: flex;
    justify-content: flex-start;
    pointer-events: none;
}

.story-viewer-meta.hidden {
    display: none;
}

.story-viewer-meta-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(2px);
    color: #fff;
    pointer-events: auto;
    cursor: pointer;
}

.story-viewer-meta-logo,
.story-viewer-meta-logo-fallback {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
}

.story-viewer-meta-name {
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    max-width: 56vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.story-viewer-like-btn {
    position: absolute;
    left: 14px;
    bottom: 24px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 12;
}

.story-viewer-like-btn.liked {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.7);
}

.story-viewer-chat-btn {
    position: absolute;
    left: 64px;
    bottom: 24px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.38);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    z-index: 12;
}

.story-viewer-chat-btn:disabled {
    opacity: 0.55;
}

.story-viewer-mute-btn {
    position: absolute;
    top: 22px;
    left: 12px;
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    padding: 0;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    z-index: 12;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
    pointer-events: auto;
    cursor: pointer;
}

.story-viewer-mute-btn svg {
    display: block;
    width: 22px;
    height: 22px;
}

.story-viewer-mute-btn.is-muted {
    color: rgba(255, 255, 255, 0.78);
}

video.story-preview-media::-webkit-media-controls {
    display: none !important;
}

video.story-preview-media::-webkit-media-controls-enclosure {
    display: none !important;
}

.story-preview-wrap.story-video-needs-tap::after {
    content: "برای پخش، روی پیش‌نمایش بزنید";
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    z-index: 2;
}

.story-bottom-tools {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 22px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.manage-story-stats-badge {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    padding: 8px 10px;
    margin-left: auto;
    margin-right: 10px;
    cursor: pointer;
}

.manage-story-stats-badge .story-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.manage-story-stats-badge .story-stat-icon {
    width: 14px;
    height: 14px;
    display: block;
    opacity: 0.92;
}

.manage-story-stats-badge .story-stat-value {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.1px;
}

.manage-story-stats-badge .story-stat-separator {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
}

.manage-story-stats-badge.hidden {
    display: none;
}

.manage-story-engagement-overlay {
    position: absolute;
    inset: 0;
    z-index: 14;
}

.manage-story-engagement-overlay.hidden {
    display: none;
}

.manage-story-engagement-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.56);
    backdrop-filter: blur(4px);
}

.manage-story-engagement-sheet {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 18px;
    max-height: 74%;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(17, 24, 39, 0.78);
    color: #fff;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.manage-story-engagement-back-btn {
    align-self: flex-start;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.manage-story-engagement-title {
    font-size: 13px;
    font-weight: 700;
}

.manage-story-engagement-list {
    overflow-y: auto;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.manage-story-engagement-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.manage-story-engagement-avatar-wrap {
    position: relative;
    width: 34px;
    height: 34px;
}

.manage-story-engagement-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}

.manage-story-engagement-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
    font-size: 13px;
    font-weight: 700;
}

.manage-story-engagement-like {
    position: absolute;
    left: -5px;
    bottom: -5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
}

.manage-story-engagement-name {
    font-size: 13px;
    font-weight: 600;
}

.manage-story-engagement-empty,
.manage-story-engagement-loading {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    text-align: center;
    padding: 14px 8px;
}

.story-gallery-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    padding: 8px 12px;
    backdrop-filter: blur(3px);
    margin-right: auto;
}

.story-gallery-btn.hidden {
    display: none;
}

.story-next-add-btn {
    pointer-events: auto;
    min-height: 42px;
    padding: 0 14px 0 10px;
    border-radius: 999px;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    margin-right: auto;
    gap: 8px;
    background: #16a34a;
    box-shadow: 0 10px 24px rgba(22, 163, 74, 0.34);
}

.story-next-add-btn.hidden {
    display: none;
}

.story-next-add-btn::before {
    content: "+";
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px dashed rgba(255, 255, 255, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.story-next-add-btn i {
    display: none;
}

.story-next-add-btn::after {
    content: "افزودن استوری";
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1;
}

.story-send-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 16px;
    padding: 11px 14px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: #07b58f;
    cursor: pointer;
    margin-left: auto;
    box-shadow: 0 10px 24px rgba(7, 181, 143, 0.34);
}

.story-send-btn:hover {
    background: #089c7b;
}

.story-send-btn.hidden {
    display: none;
}

.story-gallery-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.story-gallery-icon svg {
    width: 15px;
    height: 15px;
    display: block;
}

.story-actions-row {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
}

.story-debug-log {
    width: 100%;
    max-height: 140px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    color: #d7dde8;
    font-size: 12px;
    line-height: 1.5;
    padding: 10px 12px;
    direction: ltr;
    text-align: left;
}

.story-debug-log.hidden {
    display: none;
}

.story-debug-log .log-item {
    white-space: pre-wrap;
    word-break: break-word;
}

.story-delete-btn {
    margin-top: 0;
    width: 100%;
    background-color: #ef4444;
    color: #fff;
}

.story-delete-btn:hover {
    background-color: #dc2626;
}

.story-delete-btn.hidden {
    display: none;
}

.story-delete-icon-btn {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 12;
    border: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #d61f1f;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
}

.story-delete-icon-btn svg {
    fill: currentColor;
}

.story-delete-icon-btn.hidden {
    display: none;
}

.story-progress-bar-wrap {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 8;
    display: flex;
    gap: 6px;
    direction: ltr;
}

.story-progress-segment {
    display: block;
    height: 3px;
    background: rgba(255, 255, 255, 0.35);
    flex: 1;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.story-progress-segment.active {
    background: rgba(255, 255, 255, 0.35);
}

.story-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: #fff;
    transition: width 0.08s linear;
}
