/* Frontend Styles for WhatsApp Story Status */

* {
    box-sizing: border-box;
}

.wss-phone-frame {
    width: 390px;
    max-width: 100%;
    height: 844px;
    max-height: 90vh;
    background: #000;
    border-radius: 40px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    margin: 20px auto;
}

/* Story Picker / Thumbnails at Top */
.wss-story-picker {
    display: flex;
    gap: 8px;
    padding: 8px 12px 16px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), rgba(0,0,0,0.4));
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.wss-story-picker::-webkit-scrollbar {
    display: none;
}

.wss-story-thumb {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.wss-story-thumb::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    z-index: -1;
    transition: all 0.3s ease;
}

.wss-story-thumb.viewed::before {
    background: rgba(255, 255, 255, 0.3);
}

.wss-story-thumb.active::before {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 0 12px rgba(102, 126, 234, 0.6);
}

.wss-story-thumb-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.wss-story-thumb-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wss-story-thumb:hover {
    transform: scale(1.15);
}

.wss-story-thumb-name {
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.wss-story-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    transition: transform 0.3s ease;
}

.wss-story {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    position: relative;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
}

/* Progress Bars - Now Clickable */
.wss-story-progress {
    display: flex;
    gap: 4px;
    padding: 55px 12px 8px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
}

.wss-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.wss-progress-bar:hover {
    transform: scaleY(1.5);
    background: rgba(255, 255, 255, 0.5);
}

.wss-progress-fill {
    height: 100%;
    background: #fff;
    width: 0%;
    transition: none;
}

.wss-progress-bar.active .wss-progress-fill {
    /* Animation handled by JS */
}

.wss-progress-bar.completed .wss-progress-fill {
    width: 100%;
}

/* Story Header */
.wss-story-header {
    display: flex;
    align-items: center;
    padding: 75px 16px 16px;
    gap: 12px;
    position: relative;
    z-index: 10;
}

.wss-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.wss-user-info {
    flex: 1;
}

.wss-username {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.wss-time-ago {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Image Slider - HIGHER Z-INDEX */
.wss-image-slider {
    position: relative;
    width: 100%;
    height: 50%;
    margin: 10px 0;
    z-index: 200;
}

.wss-slider-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    z-index: 201;
}

.wss-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.wss-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

.wss-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-select: none;
}

/* Slider Controls - HIGHEST Z-INDEX */
.wss-slider-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 300;
    pointer-events: none;
}

.wss-slider-prev,
.wss-slider-next {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    pointer-events: auto;
    user-select: none;
    line-height: 1;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    position: relative;
    z-index: 9999;
    outline: none;
}

.wss-slider-prev:hover,
.wss-slider-next:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(0,0,0,0.7);
}

.wss-slider-prev:active,
.wss-slider-next:active {
    transform: scale(1.0);
    background: rgba(0, 0, 0, 1);
}

.wss-slider-prev:focus,
.wss-slider-next:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Slider Dots - HIGH Z-INDEX */
.wss-slider-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 300;
    pointer-events: none;
}

.wss-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    position: relative;
    z-index: 9999;
}

.wss-dot:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.3);
}

.wss-dot.active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

/* Story Content */
.wss-story-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    position: relative;
    z-index: 10;
}

.wss-location-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
    margin-bottom: 12px;
    backdrop-filter: blur(10px);
    align-self: flex-start;
}

.wss-story-text {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    margin-bottom: 8px;
    line-height: 1.3;
}

.wss-story-caption {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    line-height: 1.4;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* Navigation Areas - LOWEST Z-INDEX */
.wss-nav-area {
    position: absolute;
    top: 0;
    height: 100%;
    width: 25%;
    z-index: 1;
    cursor: pointer;
}

.wss-nav-prev {
    left: 0;
}

.wss-nav-next {
    right: 0;
}

/* Completion Screen */
.wss-completion-screen {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.wss-completion-screen.active {
    opacity: 1;
    visibility: visible;
}

.wss-completion-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.wss-completion-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.wss-completion-title {
    color: white;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.wss-completion-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-bottom: 30px;
    text-align: center;
}

.wss-completion-stories {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 30px;
    max-width: 100%;
    overflow-x: auto;
    padding: 10px;
}

.wss-completion-story {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.wss-completion-story:hover {
    transform: scale(1.1);
}

.wss-completion-story-thumb {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.wss-completion-story-name {
    color: white;
    font-size: 12px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.wss-replay-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.wss-replay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.wss-replay-btn svg {
    width: 20px;
    height: 20px;
}

/* Pause Indicator */
.wss-story-container.paused::after {
    content: '⏸';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60px;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 600;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Responsive */
@media (max-width: 420px) {
    .wss-phone-frame {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .wss-slider-prev,
    .wss-slider-next {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
    
    .wss-story-picker {
        gap: 6px;
        padding: 6px 10px 14px;
    }
    
    .wss-story-thumb {
        width: 32px;
        height: 32px;
    }
    
    .wss-story-thumb-inner {
        font-size: 14px;
    }
    
    .wss-story-progress {
        padding-top: 50px;
    }
    
    .wss-story-header {
        padding-top: 70px;
    }
}

@media (max-width: 768px) {
    .wss-story-text {
        font-size: 20px;
    }
    
    .wss-story-caption {
        font-size: 14px;
    }
    
    .wss-slider-controls {
        padding: 0 5px;
    }
    
    .wss-slider-prev,
    .wss-slider-next {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
    
    .wss-completion-stories {
        gap: 12px;
    }
    
    .wss-completion-story-thumb {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}

/* Loading State */
.wss-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.wss-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: wss-spin 1s linear infinite;
}

@keyframes wss-spin {
    to { transform: rotate(360deg); }
}
