:root {
    --bg-body: #08090D;
    --bg-card: #12141F;
    --border-color: rgba(255, 255, 255, 0.08);
    --insta-gradient: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --accent-glow: 0 8px 32px rgba(220, 39, 67, 0.25);
    --text-primary: #ffffff;
    --text-secondary: #8b92a5;
    --online-green: #22c55e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body.modal-open-locked {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    touch-action: none !important;
}

body {
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(220, 39, 67, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 90% 25%, rgba(188, 24, 136, 0.12) 0%, transparent 45%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(18px);
    background: rgba(8, 9, 13, 0.88);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.brand-insta-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--insta-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(220, 39, 67, 0.4);
}

.brand-text {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.5px;
}

.brand-highlight {
    background: var(--insta-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge-pro {
    font-size: 10px;
    background: #ffffff;
    color: #000;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 800;
    -webkit-text-fill-color: #000;
}

.status-indicator {
    font-size: 11px;
    font-weight: 600;
    color: var(--online-green);
    background: rgba(34, 197, 94, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--online-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--online-green);
}

.main-content {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 16px 60px;
    flex: 1;
}

.hero-section {
    text-align: center;
    margin-bottom: 20px;
}

.hero-section h1 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.hero-section p {
    color: var(--text-secondary);
    font-size: 13.5px;
}

.search-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 6px 8px 6px 14px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: 0.25s;
}

.search-wrapper:focus-within {
    border-color: rgba(220, 39, 67, 0.7);
    box-shadow: 0 0 0 4px rgba(220, 39, 67, 0.15), var(--accent-glow);
}

.prefix {
    color: #ff3b69;
    font-size: 17px;
    font-weight: 700;
    margin-right: 4px;
}

.search-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    padding: 10px 4px;
}

.search-wrapper input::placeholder { color: #52576b; }

.action-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: var(--insta-gradient);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.25s;
    flex-shrink: 0;
}

.action-btn:active { transform: scale(0.92); }
.action-btn.is-clear { background: #222638; }

.btn-icon {
    position: absolute;
    transition: transform 0.3s ease, opacity 0.25s;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.btn-icon.active { opacity: 1; transform: rotate(0deg) scale(1); }

/* Skeleton */
.loader-box {
    display: none;
    margin-top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 22px;
}

.skeleton {
    background: linear-gradient(90deg, #151827 25%, #22263d 50%, #151827 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 10px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-header { display: flex; gap: 16px; align-items: center; }
.sk-avatar { width: 80px; height: 80px; border-radius: 50%; }
.sk-info { flex: 1; }
.sk-line-1 { height: 20px; width: 60%; margin-bottom: 8px; }
.sk-line-2 { height: 14px; width: 40%; }
.sk-stats { height: 60px; margin: 18px 0; border-radius: 14px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sk-post { aspect-ratio: 1; border-radius: 10px; }

/* Profil kartasi */
.profile-section {
    display: none;
    margin-top: 20px;
    animation: slideUp 0.35s ease;
}

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

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.profile-header { display: flex; align-items: center; gap: 16px; }

.avatar-container {
    position: relative;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    padding: 3px;
    background: var(--insta-gradient);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.avatar-container:hover { transform: scale(1.05); }

.avatar-container img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid #08090D;
    background: #171926;
    display: block;
}

.avatar-container.has-story-ring {
    background: linear-gradient(45deg, #ff0055, #ffaa00, #00ff88, #00bbff, #b500ff);
    background-size: 300% 300%;
    animation: rgbGlow 3s linear infinite;
    box-shadow: 0 0 22px rgba(255, 0, 100, 0.55);
}

@keyframes rgbGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.avatar-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #dc2743;
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 8px;
    border: 2px solid #08090D;
}

.avatar-badge.badge-story {
    background: #06B6D4;
    color: #000;
    box-shadow: 0 0 10px #06B6D4;
}

.profile-details { flex: 1; min-width: 0; }
.name-row { display: flex; align-items: center; gap: 6px; }
.name-row h2 {
    font-size: 18px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.verified-icon { display: none; flex-shrink: 0; }
.handle { color: var(--text-secondary); font-size: 13.5px; margin-top: 1px; display: block; }
.category-tag {
    font-size: 12px;
    color: #7b8296;
    display: block;
    margin-top: 2px;
}

.bio-wrapper { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.external-link {
    font-size: 12px;
    color: #3897f0;
    text-decoration: none;
    font-weight: 600;
    word-break: break-all;
}
.bio {
    font-size: 12.5px;
    color: #c0c6d8;
    line-height: 1.45;
    white-space: pre-line;
}

.btn-copy-small {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #d1d5e4;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-copy-small:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.btn-copy-small.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #22c55e;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 18px 0 16px;
    padding: 14px 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    text-align: center;
}

.stat-num { font-size: 17px; font-weight: 800; display: block; }
.stat-label { font-size: 11.5px; color: var(--text-secondary); font-weight: 500; margin-top: 2px; display: block; }

.actions-grid { display: flex; gap: 8px; }

.btn-v1-primary, .btn-v1-stories {
    flex: 1;
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 13.5px;
    padding: 12px 6px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.2s;
    text-align: center;
}

.btn-v1-primary {
    background: var(--insta-gradient);
    box-shadow: 0 4px 16px rgba(220, 39, 67, 0.35);
}

.btn-v1-stories {
    background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
    box-shadow: 0 4px 16px rgba(253, 29, 29, 0.35);
}

.btn-v1-stories.no-story {
    background: rgba(255, 255, 255, 0.06);
    color: #6c7385;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-v1-primary.full-width { width: 100%; display: block; }

/* Galereya */
.media-container { margin-top: 24px; }
.media-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tab-btn {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 2.5px solid #dc2743;
    padding-bottom: 4px;
}

.media-badge { font-size: 12px; color: var(--text-secondary); font-weight: 600; }

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.post-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: #151827;
    cursor: pointer;
}

.post-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.post-item:hover img { transform: scale(1.06); }

.media-badge-icon {
    position: absolute;
    top: 7px;
    right: 7px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.post-hover {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 12px;
    font-weight: 700;
}

.post-item:hover .post-hover,
.post-item:active .post-hover { opacity: 1; }

.infinite-scroll-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 0 10px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.mini-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.12);
    border-top-color: #dc2743;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Modallar */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(18px);
    align-items: center;
    justify-content: center;
    padding: 0;
    touch-action: none;
}

.modal-box {
    position: relative;
    max-width: 440px;
    width: 100%;
    height: 100%;
    max-height: 94vh;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 480px) {
    .modal-box {
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
}

.modal-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    padding: 12px 14px;
    background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stories-progress-bar {
    display: flex;
    gap: 4px;
    width: 100%;
}

.story-bar-segment {
    flex: 1;
    height: 2.5px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 3px;
    overflow: hidden;
}

.story-bar-fill {
    height: 100%;
    width: 0%;
    background: #ffffff;
    border-radius: 3px;
}

.top-nav-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-modal-back {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: transform 0.15s, background 0.2s;
}

.btn-modal-back:active { transform: scale(0.92); }

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
}

.story-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #fff;
}

.user-info-meta {
    display: flex;
    flex-direction: column;
}

.story-header-username {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.media-type-label {
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 600;
}

.story-header-timer {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    margin-left: 6px;
}

.media-display-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    cursor: pointer;
    touch-action: none !important;
}

.media-inner-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none !important;
}

.media-display-wrapper video,
.media-display-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.slide-up-enter {
    animation: reelSlideUp 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slide-down-enter {
    animation: reelSlideDown 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes reelSlideUp {
    0% { transform: translateY(100%); opacity: 0.3; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes reelSlideDown {
    0% { transform: translateY(-100%); opacity: 0.3; }
    100% { transform: translateY(0); opacity: 1; }
}

.swipe-arrow-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(14px);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    z-index: 55;
    pointer-events: none;
}

.swipe-arrow-badge.show-arrow {
    display: flex;
    animation: arrowPulse 0.4s ease-out forwards;
}

@keyframes arrowPulse {
    0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.persistent-pause-overlay {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    z-index: 55;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.persistent-pause-overlay:active { transform: translate(-50%, -50%) scale(0.92); }

.persistent-pause-overlay.visible {
    display: flex;
    animation: pausePop 0.2s ease-out;
}

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

.pause-bars {
    display: flex;
    gap: 8px;
    height: 26px;
}

.pause-bars span {
    width: 6.5px;
    height: 100%;
    background: #ffffff;
    border-radius: 3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.carousel-counter {
    position: absolute;
    top: 60px;
    left: 14px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    z-index: 35;
}

.media-loading-box {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 40;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.media-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #dc2743;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.modal-footer {
    padding: 12px 14px 16px;
    background: linear-gradient(0deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.5) 85%, rgba(0,0,0,0) 100%);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.post-meta-scrollable {
    max-height: 140px;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: 4px;
}

.post-stats-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.stat-pill.date-pill {
    margin-left: auto;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    background: transparent;
    border: none;
    font-weight: 500;
}

.tagged-box { margin-bottom: 6px; }
.tag-title { font-size: 11px; color: var(--text-secondary); font-weight: 600; display: block; margin-bottom: 3px; }
.tags-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-badge { background: rgba(255, 255, 255, 0.1); color: #ff4d6d; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; }

.caption-container { margin-bottom: 6px; }
.modal-caption { font-size: 12.5px; color: #f1f5f9; line-height: 1.45; word-break: break-word; margin-bottom: 4px; }

.download-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.download-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    max-width: 320px;
    width: 100%;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.download-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #dc2743;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

.download-card h4 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.download-card p { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; word-break: break-all; }

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--insta-gradient);
    border-radius: 10px;
    transition: width 0.1s ease;
}

.progress-status {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.progress-status b { color: #ff3b69; }

.alert-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.alert-box {
    background: var(--bg-card);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 20px;
    max-width: 300px;
    width: 100%;
    padding: 22px;
    text-align: center;
}

.alert-icon-ring { font-size: 32px; margin-bottom: 8px; }
.alert-box h3 { font-size: 18px; margin-bottom: 6px; }
.alert-box p { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.alert-btn {
    width: 100%;
    background: #f59e0b;
    border: none;
    color: #000;
    font-weight: 800;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
}
