/* ============================================
   Pingstr - Stories Styles
   ============================================ */

/* Stories Bar */
.stories-bar {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.stories-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.stories-container::-webkit-scrollbar {
    display: none;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    min-width: 72px;
    transition: transform 0.2s;
}

.story-item:hover {
    transform: scale(1.05);
}

.story-avatar-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-avatar-wrapper.unviewed {
    background: linear-gradient(135deg, #25f4ee, #fe2c55);
}

.story-avatar-wrapper:not(.unviewed) {
    background: var(--border-color);
}

.story-avatar-wrapper img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg-secondary);
}

.story-avatar-wrapper.add {
    background: var(--bg-tertiary);
    border: 2px dashed var(--primary);
}

.story-avatar-wrapper.add i {
    font-size: 24px;
    color: var(--primary);
}

.story-username {
    font-size: 11px;
    color: var(--text-secondary);
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* Stories Viewer */
.stories-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.stories-viewer.active {
    opacity: 1;
    visibility: visible;
}

.stories-viewer-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 90vh;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.stories-viewer.active .stories-viewer-content {
    transform: scale(1);
}

.story-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}

.story-progress-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.progress-segment {
    flex: 1;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: white;
    border-radius: 2px;
}

.progress-segment.completed .progress-fill {
    width: 100%;
}

.story-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.story-viewer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.story-viewer-username {
    color: white;
    font-weight: 500;
    font-size: 14px;
}

.story-viewer-time {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
}

.story-close-btn {
    position: absolute;
    top: 40px;
    right: 12px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.story-media-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-media {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.story-text-overlay {
    position: absolute;
    bottom: 100px;
    left: 20px;
    right: 20px;
    color: white;
    font-size: 18px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
}

.story-navigation {
    position: absolute;
    top: 60px;
    bottom: 100px;
    left: 0;
    right: 0;
    display: flex;
}

.story-nav-prev,
.story-nav-next {
    flex: 1;
    cursor: pointer;
}

.story-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}

.story-reply-container {
    flex: 1;
    display: flex;
    gap: 10px;
}

.story-reply-container input {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 24px;
    padding: 10px 15px;
    color: white;
    font-size: 14px;
}

.story-reply-container input::placeholder {
    color: rgba(255,255,255,0.5);
}

.story-send-btn {
    background: var(--primary);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-action-buttons {
    display: flex;
    gap: 5px;
}

.story-action-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

.story-action-btn:hover {
    transform: scale(1.1);
}

/* Add Story Modal */
#addStoryModal {
    z-index: 10001;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

#addStoryModal .modal-content {
    border-radius: var(--radius-xl);
    max-height: calc(100vh - 40px);
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    overflow-y: auto;
}

#addStoryModal.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.add-story-content {
    max-width: 400px;
    padding: 20px;
    overflow-y: auto;
}

.add-story-preview {
    width: 100%;
    aspect-ratio: 9/16;
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.story-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-muted);
}

.story-upload-placeholder i {
    font-size: 48px;
    color: var(--primary);
}

.story-upload-placeholder span {
    font-size: 12px;
}

#storyPreviewImg,
#storyPreviewVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-text-input input {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.story-options {
    margin-bottom: 15px;
}

.story-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
}

.story-option input {
    accent-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .stories-bar {
        padding: 10px 15px;
    }
    
    .story-avatar-wrapper {
        width: 56px;
        height: 56px;
    }
    
    .story-avatar-wrapper img {
        width: 48px;
        height: 48px;
    }
    
    .stories-viewer-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}
