/* Stories Section Styles */
.stories-section {
    margin-bottom: 2rem;
}

.small-text {
    font-size: 0.8rem;
    opacity: 0.7;
}

.stories-container {
    display: flex;
    position: relative;
    margin-top: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    overflow-x: auto;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--theme-color) rgba(0, 0, 0, 0.2);
}

.stories-container::-webkit-scrollbar {
    height: 6px;
}

.stories-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.stories-container::-webkit-scrollbar-thumb {
    background-color: var(--theme-color);
    border-radius: 3px;
}

.stories-wrapper {
    display: flex;
    gap: 1rem;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.story-item:hover {
    transform: translateY(-5px);
}

.story-avatar {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 8px;
    color: var(--theme-color);
}

.story-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-avatar::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--theme-color), #ff3366, #ffcc00, var(--theme-color));
    z-index: -1;
    animation: rotate 4s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.story-avatar.viewed::before {
    background: rgba(255, 255, 255, 0.3);
    animation: none;
}

.story-username {
    font-size: 0.9rem;
    text-align: center;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--theme-color);
}

/* Create Story Styles */
.create-story .story-avatar {
    background: rgba(var(--rgb-theme-color), 0.1);
    border: 2px dashed var(--theme-color);
}

.create-story .story-avatar::before {
    display: none;
}

.add-story-icon {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    background: var(--theme-color);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    border: 2px solid #000;
}

/* Loading Placeholder */
.story-loading {
    position: relative;
    opacity: 0.5;
}

.story-loading .story-avatar {
    background: rgba(var(--rgb-theme-color), 0.1);
}

.story-loading .story-avatar::before {
    opacity: 0.3;
}

.story-loading::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 12px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(var(--rgb-theme-color), 0.1);
    border-radius: 6px;
}

/* Create Story Modal */
.create-story-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
}

.story-preview-container {
    position: relative;
    width: 100%;
    height: 400px;
    max-height: 40vh;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(var(--rgb-theme-color), 0.3);
}

.story-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.story-preview img, 
.story-preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.story-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--theme-color);
    opacity: 0.7;
}

.story-preview-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.story-creation-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.story-media-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-label {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.option-buttons {
    display: flex;
    gap: 1rem;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(var(--rgb-theme-color), 0.1);
    border: 1px solid var(--theme-color);
    color: var(--theme-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-btn:hover {
    background: rgba(var(--rgb-theme-color), 0.2);
}

.option-btn.active {
    background: rgba(var(--rgb-theme-color), 0.25);
    box-shadow: 0 0 10px rgba(var(--rgb-theme-color), 0.3);
}

.option-icon {
    font-size: 1.2rem;
}

.media-upload-label {
    display: block;
    padding: 0.8rem 1rem;
    background: rgba(var(--rgb-theme-color), 0.1);
    border: 1px solid var(--theme-color);
    color: var(--theme-color);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
}

.media-upload-label:hover {
    background: rgba(var(--rgb-theme-color), 0.2);
}

.visibility-label {
    margin-bottom: 0.5rem;
}

/* Text story styles */
.story-bg-colors {
    display: flex;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.color-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.color-dot:hover {
    transform: scale(1.1);
}

.color-dot.active {
    border-color: var(--theme-color);
    box-shadow: 0 0 10px rgba(var(--rgb-theme-color), 0.5);
}

/* View Story Modal */
#viewStoryModal {
    max-width: 500px;
    width: 90%;
    height: 90vh;
    max-height: 900px;
    border-radius: 30px;
    overflow: hidden;
    padding: 0;
}

#viewStoryModal .modal-header {
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(var(--rgb-theme-color), 0.3);
    padding: 0.8rem 1rem;
}

.story-viewer-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.story-viewer-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--theme-color);
}

.story-viewer-details {
    display: flex;
    flex-direction: column;
}

.story-time {
    font-size: 0.8rem;
    opacity: 0.7;
}

.story-viewer-content {
    position: relative;
    height: calc(100% - 60px);
    overflow: hidden;
    background: #000;
    display: flex;
    flex-direction: column;
}

.story-progress-container {
    display: flex;
    gap: 4px;
    padding: 10px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.story-progress-segment {
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    flex-grow: 1;
    overflow: hidden;
}

.story-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--theme-color);
    border-radius: 3px;
}

.story-content-area {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.story-content-area img,
.story-content-area video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.story-text-content {
    padding: 2rem;
    max-width: 90%;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.story-caption {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 1rem;
    font-size: 1rem;
    text-align: center;
}

/* New navigation styling that isolates clicks */
.story-navigation {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    pointer-events: none;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s;
    padding: 0;
}

.nav-button:hover {
    background: rgba(0, 0, 0, 0.6);
}

.prev-button {
    left: 15px;
}

.next-button {
    right: 15px;
}

/* Remove any existing nav-arrow styles */
.nav-arrow {
    display: none;
}

.story-reaction-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 3rem;
    background: rgba(0, 0, 0, 0.7);
}

.story-reaction {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.story-reaction:hover {
    transform: scale(1.2);
}

.reaction-icon {
    font-size: 1.5rem;
}

.story-reply-form {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    gap: 0.5rem;
    z-index: 20;
}

.story-reply-form input {
    flex: 1;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: #fff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .story-avatar {
        width: 70px;
        height: 70px;
    }
    
    .add-story-icon {
        width: 24px;
        height: 24px;
        font-size: 1rem;
    }
    
    .story-item {
        min-width: 80px;
    }
    
    .story-username {
        font-size: 0.8rem;
        max-width: 80px;
    }
    
    .option-buttons {
        flex-wrap: wrap;
    }
    
    .option-btn {
        flex: 1;
        min-width: 100px;
    }
    
    .create-story-content {
        padding: 1rem;
    }
    
    .story-preview-container {
        height: 300px;
    }
    
    #viewStoryModal {
        width: 95%;
        height: 80vh;
    }
}

/* Text story customization */
.text-story-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.text-story-inner {
    max-width: 100%;
    text-align: center;
    font-weight: bold;
    color: #fff;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    word-break: break-word;
}

/* Archives Button */
.archives-btn {
    position: absolute;
    right: 0;
    top: 0;
    background: rgba(var(--rgb-theme-color), 0.1);
    border: 1px solid var(--theme-color);
    color: var(--theme-color);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.archives-btn:hover {
    background: rgba(var(--rgb-theme-color), 0.2);
    transform: translateY(-1px);
}

/* Archives Modal */
.archives-content {
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
}

.archives-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(var(--rgb-theme-color), 0.05);
    border-radius: 12px;
    border: 1px solid rgba(var(--rgb-theme-color), 0.2);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--theme-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.archives-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.archives-select {
    flex: 1;
    padding: 0.6rem;
    background: rgba(var(--rgb-theme-color), 0.1);
    border: 1px solid rgba(var(--rgb-theme-color), 0.3);
    border-radius: 8px;
    color: var(--theme-color);
    font-size: 0.9rem;
}

.archives-select option {
    background: #000;
    color: var(--theme-color);
}

/* Archives Grid */
.archives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.archive-story-tile {
    position: relative;
    aspect-ratio: 9/16;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.archive-story-tile:hover {
    transform: translateY(-4px);
    border-color: var(--theme-color);
    box-shadow: 0 8px 25px rgba(var(--rgb-theme-color), 0.3);
}

.archive-story-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}

.archive-story-preview img,
.archive-story-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.archive-text-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-weight: bold;
    text-align: center;
    font-size: 0.9rem;
    word-break: break-word;
}

.archive-story-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 1rem 0.5rem 0.5rem;
    color: white;
}

.archive-story-type {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.archive-story-date {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.archive-story-stats {
    display: flex;
    gap: 0.8rem;
    font-size: 0.7rem;
}

.archive-stat {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.archives-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--theme-color);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(var(--rgb-theme-color), 0.3);
    border-top: 3px solid var(--theme-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.archives-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--theme-color);
    opacity: 0.7;
}

.archives-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Pagination */
.archives-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    background: rgba(var(--rgb-theme-color), 0.1);
    border: 1px solid var(--theme-color);
    color: var(--theme-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(var(--rgb-theme-color), 0.2);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Archive Detail Modal */
.archive-detail-content {
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
}

.archive-story-display {
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(var(--rgb-theme-color), 0.05);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.archive-story-display img,
.archive-story-display video {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.archive-detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(var(--rgb-theme-color), 0.05);
    border-radius: 12px;
}

.archive-detail-stat {
    text-align: center;
}

.archive-detail-stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--theme-color);
}

.archive-detail-stat-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.archive-story-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn.secondary {
    background: rgba(var(--rgb-theme-color), 0.1);
    border: 1px solid var(--theme-color);
    color: var(--theme-color);
}

.btn.secondary:hover {
    background: rgba(var(--rgb-theme-color), 0.2);
}

.btn.danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ef4444;
}

.btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn svg {
    margin-right: 0.5rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .archives-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .archives-filters {
        flex-direction: column;
    }
    
    .archives-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.8rem;
    }
    
    .archive-story-actions {
        flex-direction: column;
    }
    
    .archives-btn {
        position: static;
        margin-left: auto;
        margin-top: 0.5rem;
    }
}

h2 {
    position: relative;
}

