/* Story qo'shish tugmasi */
.add-story-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px dashed #4CB9B5;
    background: rgba(76, 185, 181, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.add-story-btn:hover {
    background: rgba(76, 185, 181, 0.2);
    transform: scale(1.05);
}

.add-story-btn i {
    font-size: 20px;
    color: #4CB9B5;
    line-height: 1;
}

/* Story Item Wrapper */
.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    width: 60px;
    min-height: 75px;
}

/* Ko'rilmagan story (rangli border) */
.story-unseen {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4CB9B5 0%, #2C8E8A 100%);
}

.story-unseen img,
.story-unseen>div {
    border: 2px solid white;
}

/* Ko'rilgan story (oq border) */
.story-seen {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 50%;
    background: #e5e7eb;
}

.story-seen img,
.story-seen>div {
    border: 2px solid white;
}

/* Story name label */
.story-label-name {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
    line-height: 1.2;
}

/* Story soni badge */
.story-count-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #4CB9B5;
    color: white;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
    border: 2px solid #F8F8F8;
    padding: 0 3px;
}

/* Story modal */
.story-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile */
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.story-modal.show {
    display: flex !important;
}

.story-wrap {
    width: 100%;
    max-width: 520px;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile */
    max-height: 100vh;
    max-height: 100dvh;
    position: relative;
    background: #000;
    overflow: hidden;
}

.story-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    z-index: 20;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
}

.progress-bars {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.progress-bars .seg {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bars .seg span {
    display: block;
    height: 100%;
    width: 0;
    background: #fff;
}

.brand-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.story-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.story-meta img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.story-name {
    font-weight: 700;
    font-size: 14px;
}

.story-time {
    font-size: 12px;
    opacity: 0.7;
}

.story-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

/* Content area */
.story-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.story-content img,
.story-content video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Loading spinner */
.story-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.loading-hidden {
    display: none !important;
}

/* Tap zones */
.tap-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    z-index: 5;
    cursor: pointer;
}

.tap-zone.left {
    left: 0;
}

.tap-zone.right {
    right: 0;
    width: 60%;
}

/* Pulse animation */
@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(76, 185, 181, 0.7);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(76, 185, 181, 0);
    }
}

/* Viewers list */
.story-viewers-list {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 30;
    color: #1f2937;
    max-height: 60%;
    overflow-y: auto;
}

.story-viewers-list.show {
    transform: translateY(0);
}

.viewer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.viewer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.viewer-name {
    font-weight: 600;
    font-size: 14px;
    margin: 0;
}

.viewer-time {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

/* Story Menu */
.story-menu {
    position: absolute;
    top: 50px;
    right: 15px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 40;
    overflow: hidden;
    min-width: 160px;
}

.story-menu.show {
    display: block;
}

.story-menu-item {
    padding: 12px 16px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.story-menu-item:hover {
    background: #f9fafb;
}

.story-menu-item.delete {
    color: #ef4444;
}

/* Story upload */
.story-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.story-upload-area:hover {
    border-color: #4CB9B5;
    background: #f0fdfa;
}

/* Modal Current Stories Styles */
.current-stories h6 {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
}

.story-thumb-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.story-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    position: relative;
}

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

.story-thumb .btn-delete {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    border: 2px solid white;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 5;
}