/* ========================================
   STORIES BAR COMPONENT STYLES
   Instagram-style stories bar for Chequea
   ======================================== */

/* Stories Bar Container - Fixed below header */
.stories-bar {
    position: fixed;
    top: 56px; /* Below chequea header */
    left: 0;
    right: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.95);
    padding: 16px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.stories-bar-scroll {
    display: flex;
    gap: 16px;
    padding: 0 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.stories-bar-scroll::-webkit-scrollbar {
    display: none;
}

/* Story Circle */
.story-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    scroll-snap-align: start;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.story-circle:hover {
    transform: scale(1.05);
}

.story-circle:active {
    transform: scale(0.95);
}

/* Avatar Container */
.story-circle-avatar {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 3px;
    background: rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

/* Has stories - gradient ring */
.story-circle-avatar.has-stories {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
}

/* Unviewed stories - animated gradient */
.story-circle-avatar.has-stories.unviewed {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
    animation: story-ring-pulse 2s ease-in-out infinite;
}

/* Viewed stories - gray ring */
.story-circle-avatar.has-stories.viewed {
    background: rgba(255,255,255,0.3);
}

@keyframes story-ring-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
    }
}

/* Avatar Image/Initial */
.story-circle-avatar img,
.story-circle-avatar .story-circle-initial {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #000;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
}

.story-circle-avatar img {
    background: #1f2937;
}

/* Add Badge (+ icon) */
.story-add-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: 2px solid #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Story Name */
.story-circle-name {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    max-width: 64px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Story Count Badge */
.story-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #22c55e;
    border: 2px solid #000;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* My Story - Special styling */
.story-circle.my-story .story-circle-name {
    color: #22c55e;
    font-weight: 600;
}

/* Empty State */
.stories-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    font-style: italic;
}

/* Loading Skeleton */
.stories-loading {
    display: flex;
    gap: 16px;
    padding: 0 16px;
}

.story-circle-skeleton {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   STORY OPTIONS MODAL
   ======================================== */

.story-options-modal {
    position: fixed;
    inset: 0;
    z-index: 10010;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.story-options-modal.show {
    opacity: 1;
    visibility: visible;
}

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

.story-options-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: #1f2937;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.story-options-modal.show .story-options-content {
    transform: translateY(0);
}

.story-option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px;
    background: rgba(255,255,255,0.05);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.story-option-btn:hover {
    background: rgba(255,255,255,0.1);
}

.story-option-btn:active {
    transform: scale(0.98);
}

.story-option-btn svg {
    color: #22c55e;
    flex-shrink: 0;
}

.story-option-btn.cancel {
    background: transparent;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    margin-top: 8px;
    margin-bottom: 0;
}

.story-option-btn.cancel:hover {
    color: white;
}

.story-option-disabled {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px;
    background: rgba(255,255,255,0.02);
    border-radius: 12px;
    color: rgba(255,255,255,0.3);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 8px;
}

.story-option-disabled svg {
    color: rgba(255,255,255,0.2);
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .stories-bar {
        top: 48px; /* Smaller header on mobile */
        padding: 12px 0;
    }

    .stories-bar-scroll {
        gap: 12px;
        padding: 0 12px;
    }

    .story-circle-avatar {
        width: 56px;
        height: 56px;
    }

    .story-circle-avatar img,
    .story-circle-avatar .story-circle-initial {
        font-size: 18px;
    }

    .story-circle-name {
        font-size: 10px;
        max-width: 56px;
    }

    .story-add-badge {
        width: 20px;
        height: 20px;
    }

    .story-add-badge svg {
        width: 10px;
        height: 10px;
    }

    .story-count {
        min-width: 16px;
        height: 16px;
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .story-circle-avatar {
        width: 52px;
        height: 52px;
    }

    .story-circle-name {
        max-width: 52px;
    }
}
