@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --ig-bg: #FFFFFF;
    --ig-text: #262626;
    --ig-text-secondary: #737373;
    --ig-border: #DBDBDB;
    --ig-primary: #0095F6;
    --ig-primary-hover: #1877F2;
    --ig-link: #00376B;
    --ig-btn-bg: #EFEFEF;
    --ig-btn-text: #262626;
    --ig-story-ring-1: #F58529;
    --ig-story-ring-2: #DD2A7B;
    --ig-story-ring-3: #8134AF;
}

[data-theme="dark"] {
    --ig-bg: #000000;
    --ig-text: #F5F5F5;
    --ig-text-secondary: #A8A8A8;
    --ig-border: #262626;
    --ig-primary: #0095F6;
    --ig-link: #E0F1FF;
    --ig-btn-bg: #363636;
    --ig-btn-text: #F5F5F5;
}

* { box-sizing: border-box; }
body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #FAFAFA;
    color: var(--ig-text);
}

.mobile-container {
    width: 100%; max-width: 480px;
    margin: 0 auto;
    background: var(--ig-bg);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
    overflow-x: hidden;
}

/* COVER - STORY VIEW */
#cover {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100dvh;
    background: #000; z-index: 9999;
    display: flex; flex-direction: column;
}
.story-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; filter: brightness(0.7);
}
.story-overlay {
    position: relative; z-index: 10; width: 100%; height: 100%;
    display: flex; flex-direction: column; padding: 20px;
}
.story-progress {
    display: flex; gap: 4px; width: 100%; margin-bottom: 12px;
}
.story-progress-bar {
    flex: 1; height: 2px; background: rgba(255,255,255,0.3); border-radius: 2px; position: relative;
}
.story-progress-fill {
    position: absolute; top: 0; left: 0; height: 100%; width: 0%;
    background: #FFF; border-radius: 2px;
}
.story-header {
    display: flex; align-items: center; gap: 10px; color: #FFF;
}
.story-avatar {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
}
.story-username {
    font-weight: 600; font-size: 0.85rem; text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.story-time {
    color: rgba(255,255,255,0.7); font-size: 0.8rem;
}
.story-content {
    flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
    color: #FFF; text-align: center;
}
.story-title {
    font-size: 2rem; font-weight: 700; margin-bottom: 10px; text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.story-subtitle {
    font-size: 1rem; text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.story-action {
    margin-top: auto; padding-bottom: max(50px, env(safe-area-inset-bottom, 50px)); text-align: center;
}
.swipe-up-btn {
    background: rgba(0,0,0,0.5); backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2); color: #FFF;
    border-radius: 20px; padding: 12px 24px; font-weight: 600; font-size: 0.9rem;
    cursor: pointer; animation: bounce 2s infinite;
}
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* APP HEADER */
.ig-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--ig-border);
    position: sticky; top: 0; background: var(--ig-bg); z-index: 100;
}
.ig-header-left { display: flex; align-items: center; gap: 4px; }
.ig-header-username { font-weight: 700; font-size: 1.1rem; }
.verified-badge { width: 14px; height: 14px; color: var(--ig-primary); }

/* PROFILE INFO */
.profile-section { padding: 16px; }
.profile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.profile-avatar-wrap { position: relative; width: 86px; height: 86px; border-radius: 50%; padding: 3px; background: linear-gradient(45deg, var(--ig-story-ring-1), var(--ig-story-ring-2), var(--ig-story-ring-3)); }
.profile-avatar { width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--ig-bg); object-fit: cover; }
.profile-stats { flex: 1; display: flex; justify-content: space-around; margin-left: 20px; }
.stat-item { text-align: center; }
.stat-val { font-weight: 700; font-size: 1.1rem; }
.stat-label { font-size: 0.8rem; color: var(--ig-text); }

/* BIO */
.profile-bio { font-size: 0.9rem; line-height: 1.4; margin-bottom: 16px; }
.bio-name { font-weight: 600; margin-bottom: 4px; }
.bio-category { color: var(--ig-text-secondary); margin-bottom: 4px; }
.bio-text { margin-bottom: 4px; }
.bio-link { color: var(--ig-link); text-decoration: none; font-weight: 500; }

/* ACTION BUTTONS */
.profile-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.btn-ig {
    flex: 1; padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 0.9rem;
    text-align: center; cursor: pointer; border: none; font-family: inherit;
}
.btn-ig-primary { background: var(--ig-primary); color: #FFF; }
.btn-ig-secondary { background: var(--ig-btn-bg); color: var(--ig-btn-text); }

/* HIGHLIGHTS */
.highlights-container { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; scrollbar-width: none; }
.highlights-container::-webkit-scrollbar { display: none; }
.highlight-item { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.highlight-ring { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--ig-border); padding: 3px; }
.highlight-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--ig-btn-bg); display: flex; align-items: center; justify-content: center; }
.highlight-name { font-size: 0.75rem; color: var(--ig-text); }

/* TABS */
.ig-tabs { display: flex; border-top: 1px solid var(--ig-border); }
.ig-tab { flex: 1; text-align: center; padding: 12px; cursor: pointer; color: var(--ig-text-secondary); border-bottom: 1px solid transparent; }
.ig-tab.active { color: var(--ig-text); border-top: 1px solid var(--ig-text); margin-top: -1px; }

/* GRID VIEW */
.grid-view { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.grid-item { aspect-ratio: 1; position: relative; cursor: pointer; background: var(--ig-btn-bg); }
.grid-img { width: 100%; height: 100%; object-fit: cover; }
.grid-icon { position: absolute; top: 8px; right: 8px; color: #FFF; drop-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* POST / FEED VIEW */
.feed-view { display: none; padding-bottom: 60px; }
.post-item { border-bottom: 1px solid var(--ig-border); margin-bottom: 16px; }
.post-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.post-user { display: flex; align-items: center; gap: 10px; }
.post-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.post-username { font-weight: 600; font-size: 0.9rem; }
.post-location { font-size: 0.75rem; color: var(--ig-text); }
.post-img-wrap { width: 100%; position: relative; background: #000; }
.post-img { width: 100%; max-height: 500px; object-fit: contain; }
.post-actions { display: flex; justify-content: space-between; padding: 12px 16px 8px; }
.action-left { display: flex; gap: 16px; }
.post-likes { padding: 0 16px; font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; }
.post-caption { padding: 0 16px; font-size: 0.9rem; line-height: 1.4; margin-bottom: 8px; }
.post-time { padding: 0 16px 12px; font-size: 0.7rem; color: var(--ig-text-secondary); text-transform: uppercase; }

/* FORMS IN FEED */
.ig-form { display: flex; flex-direction: column; gap: 12px; padding: 0 16px 16px; }
.ig-input { width: 100%; background: var(--ig-bg); border: 1px solid var(--ig-border); color: var(--ig-text); padding: 12px; border-radius: 8px; font-family: inherit; font-size: 0.9rem; }
.ig-input:focus { outline: none; border-color: var(--ig-text-secondary); }

/* BOTTOM NAV */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 50px;
    background: var(--ig-bg); border-top: 1px solid var(--ig-border);
    display: flex; justify-content: space-around; align-items: center; z-index: 100;
}
.mobile-container .bottom-nav { position: sticky; }
.nav-item { color: var(--ig-text); cursor: pointer; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
.nav-avatar { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--ig-border); object-fit: cover; }

/* MODAL / BOTTOM SHEET */
.ig-sheet {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100dvh;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; flex-direction: column; justify-content: flex-end;
    opacity: 0; pointer-events: none; transition: 0.3s;
}
.ig-sheet.active { opacity: 1; pointer-events: auto; }
.sheet-content {
    background: var(--ig-bg); border-radius: 16px 16px 0 0; padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 34px));
    transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1);
    max-height: 85vh; overflow-y: auto;
}
.ig-sheet.active .sheet-content { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; background: var(--ig-border); border-radius: 2px; margin: 0 auto 20px; }

/* MUSIC TOGGLE */
.music-toggle {
    position: fixed; right: 14px; bottom: 70px;
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--ig-border);
    background: var(--ig-btn-bg); color: var(--ig-text);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 50; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.music-toggle:active { transform: scale(0.9); }
 
 