/* Wedding Stories - Instagram-like Styles */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Quicksand:wght@300;400;500;600&display=swap');

:root {
    --bg-primary: #faf9f7;
    --bg-secondary: #ffffff;
    --bg-dark: #1a1a1a;
    --text-primary: #262626;
    --text-secondary: #8e8e8e;
    --text-light: #c7c7c7;
    --accent-gold: #d4a574;
    --accent-rose: #e8b4b8;
    --accent-sage: #b8c4b8;
    --gradient-story: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --gradient-love: linear-gradient(135deg, #e8b4b8 0%, #d4a574 100%);
    --shadow-soft: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 12px 16px;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--gradient-love);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-hashtag {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ===== STORIES BAR ===== */
.stories-bar {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 12px 0;
}

.stories-container {
    display: flex;
    gap: 12px;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
}

.stories-container::-webkit-scrollbar {
    display: none;
}

.story-bubble {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    scroll-snap-align: start;
}

.story-ring {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-full);
    padding: 3px;
    background: var(--gradient-story);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.story-ring.viewed {
    background: var(--text-light);
}

.story-bubble:active .story-ring {
    transform: scale(0.95);
    opacity: 0.8;
}

.story-avatar {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    border: 3px solid var(--bg-secondary);
    object-fit: cover;
    background: var(--bg-primary);
}

.story-avatar.video-thumb::after {
    content: '▶';
    position: absolute;
    font-size: 12px;
    color: white;
}

.story-name {
    font-size: 0.7rem;
    color: var(--text-primary);
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    font-weight: 500;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding-top: 150px;
    padding-bottom: 100px;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== FEED ===== */
.feed {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px;
}

.feed-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.feed-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.feed-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--gradient-love);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.feed-info {
    flex: 1;
}

.feed-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.feed-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.feed-media {
    width: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
    background: var(--bg-dark);
    display: block;
}

.feed-video {
    width: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
    background: var(--bg-dark);
}

.feed-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: transform 0.15s ease;
}

.action-btn:active {
    transform: scale(0.9);
}

.action-btn.liked svg {
    fill: #ed4956;
    color: #ed4956;
}

.action-btn svg {
    width: 24px;
    height: 24px;
}

.like-count {
    font-weight: 600;
}

/* ===== STORY VIEWER (Full Screen Modal) ===== */
.story-viewer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg-dark);
    display: none;
    flex-direction: column;
}

.story-viewer.active {
    display: flex;
}

.story-progress-bar {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

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

.progress-fill {
    height: 100%;
    background: white;
    width: 0;
    transition: width 0.1s linear;
}

.story-header {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.story-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.story-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--gradient-love);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.story-user-info {
    color: white;
}

.story-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.story-user-time {
    font-size: 0.75rem;
    opacity: 0.8;
}

.story-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    font-size: 1.5rem;
    line-height: 1;
}

.story-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.story-media {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.story-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30%;
    height: 60%;
    cursor: pointer;
}

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

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

/* ===== UPLOAD BUTTON ===== */
.upload-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 80;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--gradient-story);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(220, 39, 67, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.upload-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(220, 39, 67, 0.5);
}

.upload-fab:active {
    transform: scale(0.95);
}

.upload-fab svg {
    width: 28px;
    height: 28px;
    color: white;
}

/* ===== UPLOAD MODAL ===== */
.upload-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.upload-modal.active {
    display: flex;
}

.upload-sheet {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.upload-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.upload-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 600;
}

.upload-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.upload-body {
    padding: 24px;
}

.upload-preview {
    width: 100%;
    aspect-ratio: 4/5;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    border: 2px dashed var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    overflow: hidden;
    position: relative;
}

.upload-preview:hover {
    border-color: var(--accent-gold);
    background: rgba(212, 165, 116, 0.05);
}

.upload-preview.has-media {
    border: none;
}

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

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-light);
}

.upload-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-light);
}

.upload-options {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.upload-option {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0,0,0,0.1);
    background: var(--bg-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.upload-option:hover {
    border-color: var(--accent-gold);
    background: rgba(212, 165, 116, 0.05);
}

.upload-option svg {
    width: 24px;
    height: 24px;
    color: var(--accent-gold);
}

.upload-option span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.name-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    margin-top: 16px;
    transition: border-color 0.2s ease;
}

.name-input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.submit-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--gradient-story);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-top: 16px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-btn:not(:disabled):hover {
    opacity: 0.9;
}

.submit-btn:not(:disabled):active {
    transform: scale(0.98);
}

/* ===== LOADING STATES ===== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 165, 116, 0.2);
    border-top-color: var(--accent-gold);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

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

.upload-progress {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: white;
    border-radius: var(--radius-md);
}

.progress-bar {
    width: 80%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-story);
    transition: width 0.3s ease;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-icon {
    width: 80px;
    height: 80px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.empty-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-dark);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-medium);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: #4caf50;
}

.toast.error {
    background: #f44336;
}

/* ===== WELCOME OVERLAY ===== */
.welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: linear-gradient(135deg, #faf9f7 0%, #f5f0eb 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

.welcome-overlay.hidden {
    display: none;
}

.welcome-hearts {
    font-size: 3rem;
    margin-bottom: 24px;
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.welcome-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 8px;
    background: var(--gradient-love);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.welcome-input {
    width: 100%;
    max-width: 300px;
    padding: 16px 20px;
    border: 2px solid var(--accent-gold);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-family: inherit;
    text-align: center;
    margin-bottom: 16px;
}

.welcome-input:focus {
    outline: none;
    border-color: var(--accent-rose);
}

.welcome-btn {
    padding: 16px 48px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--gradient-love);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.welcome-btn:hover {
    opacity: 0.9;
}

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

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
    .header {
        padding: 16px 24px;
    }
    
    .stories-bar {
        top: 64px;
    }
    
    .main-content {
        padding-top: 170px;
    }
    
    .upload-modal {
        align-items: center;
    }
    
    .upload-sheet {
        border-radius: var(--radius-lg);
        max-height: 85vh;
    }
}

/* ===== DARK MODE (optional, based on system preference) ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #121212;
        --bg-secondary: #1e1e1e;
        --text-primary: #f5f5f5;
        --text-secondary: #a0a0a0;
        --text-light: #666;
    }
    
    .header {
        background: rgba(30,30,30,0.92);
        border-bottom-color: rgba(255,255,255,0.05);
    }
    
    .stories-bar {
        background: var(--bg-secondary);
        border-bottom-color: rgba(255,255,255,0.05);
    }
    
    .story-ring {
        border-color: var(--bg-secondary);
    }
    
    .story-avatar {
        border-color: var(--bg-secondary);
    }
    
    .welcome-overlay {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    }
}
