/*
Theme Name: MangaStream Pro App UX
Theme URI: https://denji.dev
Author: Denji
Description: Native mobil uygulama hissiyatlı, AMOLED Dark, Touch-optimized manga teması.
Version: 3.0
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    /* AMOLED & Neon Palette */
    --bg-app:        #08080a;
    --bg-card:       #101014;
    --bg-elevated:   #16161c;
    --bg-glass:      rgba(16, 16, 20, 0.72);
    --accent:        #7c3aed;
    --accent-light:  #9d5af5;
    --accent-glow:   rgba(124, 58, 237, 0.35);
    --accent-subtle: rgba(124, 58, 237, 0.12);
    --secondary:     #06b6d4;
    --secondary-glow:rgba(6, 182, 212, 0.25);
    --success:       #22c55e;
    --danger:        #ef4444;
    --warning:       #f97316;
    --text-main:     #f4f4f5;
    --text-muted:    #71717a;
    --text-sub:      #a1a1aa;
    --border-glass:  rgba(255, 255, 255, 0.06);
    --border-accent: rgba(124, 58, 237, 0.3);

    /* Spacing & Shape */
    --radius-xs:  8px;
    --radius-sm:  12px;
    --radius-md:  18px;
    --radius-lg:  24px;
    --radius-xl:  32px;
    --nav-height: 64px;
    --header-height: 58px;
    --safe-bottom: env(safe-area-inset-bottom, 16px);
    --safe-top:    env(safe-area-inset-top, 0px);
}

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
html {
    overscroll-behavior-y: none;
    scroll-behavior: smooth;
}
body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
    min-height: 100dvh;
}

/* Scrollbar */
::-webkit-scrollbar { display: none; }
.hide-scroll { -ms-overflow-style: none; scrollbar-width: none; }
a { color: inherit; text-decoration: none; }

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}
@keyframes pulse-ring {
    0%   { transform: scale(0.9); opacity: 1; }
    100% { transform: scale(1.8); opacity: 0; }
}
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 12px var(--accent-glow); }
    50%       { box-shadow: 0 0 24px var(--accent-glow), 0 0 40px var(--accent-glow); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Glass ── */
.app-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--border-glass);
}

/* ── Header ── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-height);
    background: rgba(8, 8, 10, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border-glass);
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 16px;
}
.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.header-logo-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px var(--accent-glow);
    flex-shrink: 0;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.icon-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-glass);
    color: var(--text-sub);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.icon-btn:active { background: var(--accent-subtle); color: var(--accent-light); }
.icon-btn svg { width: 18px; height: 18px; }
.notif-dot {
    position: absolute;
    top: 4px; right: 4px;
    width: 7px; height: 7px;
    background: var(--accent);
    border-radius: 50%;
    border: 1.5px solid var(--bg-app);
    animation: glow-pulse 2s ease-in-out infinite;
}
.nsfw-chip {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--danger);
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 20px;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: background 0.2s;
}
.nsfw-chip:active { background: rgba(239,68,68,0.2); }

/* ── Bottom Navigation ── */
.app-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    background: rgba(8, 8, 10, 0.92);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid var(--border-glass);
    padding-bottom: var(--safe-bottom);
    z-index: 200;
}
.app-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--nav-height);
    padding: 0 8px;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    padding: 6px 4px;
    color: var(--text-muted);
    transition: color 0.2s;
    position: relative;
    border-radius: var(--radius-sm);
}
.nav-item.active { color: var(--accent-light); }
.nav-item.active .nav-icon-wrap {
    background: var(--accent-subtle);
}
.nav-icon-wrap {
    width: 36px;
    height: 28px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.nav-icon-wrap svg { width: 20px; height: 20px; }
.nav-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.nav-item.active .nav-label { color: var(--accent-light); }

/* ── Swipe Row ── */
.swipe-row {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 14px;
    padding: 0 18px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.swipe-row > * {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* ── Section Header ── */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
    margin-bottom: 14px;
}
.section-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title-icon {
    font-size: 1.1rem;
}
.section-more {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-light);
    display: flex;
    align-items: center;
    gap: 3px;
}
.section-more svg { width: 14px; height: 14px; }

/* ── App Card ── */
.app-card {
    position: relative;
    width: 138px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    overflow: hidden;
    border: 1px solid var(--border-glass);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.app-card:active {
    transform: scale(0.96);
}
.app-card-img-wrap {
    width: 100%;
    aspect-ratio: 2 / 3;
    position: relative;
    overflow: hidden;
}
.app-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.app-card-info {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 32px 10px 10px;
    background: linear-gradient(to top, rgba(8,8,10,0.97) 0%, rgba(8,8,10,0.6) 55%, transparent 100%);
    z-index: 5;
}
.app-card-title {
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}
.app-card-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

/* ── Progress ── */
.read-progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 2.5px;
    background: linear-gradient(90deg, var(--accent), var(--secondary));
    border-radius: 0 2px 2px 0;
    z-index: 10;
}

/* ── Badges ── */
.app-badge {
    position: absolute;
    top: 8px; left: 8px;
    padding: 3px 7px;
    border-radius: var(--radius-xs);
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-glass);
    z-index: 10;
}
.badge-ongoing { background: rgba(34,197,94,0.18); color: var(--success); border-color: rgba(34,197,94,0.3); }
.badge-adult   { background: rgba(239,68,68,0.18); color: var(--danger);  border-color: rgba(239,68,68,0.3); }
.badge-hot     { background: rgba(249,115,22,0.18); color: var(--warning); border-color: rgba(249,115,22,0.3); }
.badge-new     { background: rgba(6,182,212,0.18); color: var(--secondary); border-color: rgba(6,182,212,0.3); }
.badge-top     { background: rgba(124,58,237,0.25); color: var(--accent-light); border-color: rgba(124,58,237,0.4); }

/* ── Hero Cards ── */
.hero-card {
    width: 82vw;
    max-width: 380px;
    flex-shrink: 0;
    scroll-snap-align: center;
    position: relative;
    height: 300px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border-glass);
}
.hero-card-bg {
    position: absolute;
    inset: -20px;
    background-size: cover;
    background-position: center;
    filter: blur(28px) brightness(0.45);
    z-index: 1;
    transform: scale(1.1);
}
.hero-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8,8,10,0.1) 0%, rgba(8,8,10,0.75) 60%, rgba(8,8,10,0.98) 100%);
    z-index: 2;
}
.hero-card-rank {
    position: absolute;
    top: 14px; left: 14px;
    width: 32px; height: 32px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.85rem;
    z-index: 10;
    box-shadow: 0 0 16px var(--accent-glow);
}
.hero-card-body {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    z-index: 10;
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding: 16px;
}
.hero-cover-thumb {
    width: 108px;
    height: 158px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0,0,0,0.7);
    flex-shrink: 0;
    border: 1px solid var(--border-glass);
}
.hero-cover-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-card-info { flex: 1; padding-bottom: 2px; min-width: 0; }
.hero-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.chip-accent { background: var(--accent); color: #fff; }
.chip-glass  { background: rgba(255,255,255,0.15); color: var(--text-main); }
.chip-danger { background: rgba(239,68,68,0.2); color: var(--danger); border: 1px solid rgba(239,68,68,0.4); }
.hero-title {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hero-genre {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 12px;
}
.hero-actions { display: flex; gap: 8px; align-items: center; }
.btn-primary {
    flex: 1;
    background: var(--text-main);
    color: var(--bg-app);
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-lg);
    font-weight: 800;
    font-size: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.btn-primary:active { opacity: 0.8; }
.btn-circle {
    width: 34px; height: 34px;
    background: rgba(255,255,255,0.12);
    border: 1px solid var(--border-glass);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
    font-size: 1.1rem;
}
.btn-circle:active { background: var(--accent-subtle); }

/* ── Skeleton Loading ── */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ── Chapter Item ── */
.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    transition: background 0.15s;
}
.chapter-item:active { background: var(--bg-elevated); }
.chapter-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    flex-shrink: 0;
}
.chapter-dot.read { background: var(--text-muted); box-shadow: none; }

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    padding: 10px 6px;
    border-radius: var(--radius-sm);
    text-align: center;
}
.stat-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}
.stat-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-top: 3px;
    font-weight: 600;
}

/* ── Auth Modal ── */
.auth-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 10000;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.auth-modal.open { display: flex; }
.auth-sheet {
    background: var(--bg-card);
    width: 100%;
    max-width: 480px;
    padding: 28px 24px calc(28px + var(--safe-bottom));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-top: 1px solid var(--border-glass);
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.auth-handle {
    width: 36px; height: 4px;
    background: var(--border-glass);
    border-radius: 2px;
    margin: 0 auto 24px;
}
.auth-logo-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}
.auth-logo-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    border-radius: 14px;
    box-shadow: 0 0 24px var(--accent-glow);
}
.auth-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: var(--bg-elevated);
    color: var(--text-main);
    font-size: 0.95rem;
    margin-bottom: 10px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.auth-input:focus { border-color: var(--accent); }
.btn-auth {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    border: none;
    padding: 15px;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 6px 20px var(--accent-glow);
    transition: opacity 0.2s;
    margin-top: 6px;
    font-family: inherit;
}
.btn-auth:active { opacity: 0.85; }

/* ── Search Modal ── */
.search-modal {
    position: fixed;
    inset: 0;
    background: var(--bg-app);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    padding: 16px;
    padding-top: calc(16px + var(--safe-top));
    animation: fadeIn 0.18s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 0 14px;
    margin-bottom: 16px;
}
.search-bar svg { color: var(--text-muted); width: 18px; height: 18px; flex-shrink: 0; }
.search-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1rem;
    padding: 13px 0;
    outline: none;
    font-family: inherit;
}

/* ── NSFW Blur ── */
.nsfw-blur-cover {
    filter: blur(18px) brightness(0.6);
    transform: scale(1.08);
    transition: filter 0.3s ease;
}
.nsfw-icon-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 10;
    pointer-events: none;
}

/* ── Ad Containers ── */
.manga-ad-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: var(--radius-sm);
}
.manga-mobile-sticky-ad {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom));
    left: 0;
    width: 100%;
    background: rgba(8,8,10,0.95);
    border-top: 1px solid var(--border-glass);
    z-index: 199;
    text-align: center;
    display: none;
    padding: 5px 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    backdrop-filter: blur(12px);
}
@media (max-width: 768px) {
    .manga-mobile-sticky-ad { display: block; }
}

/* ── Reader ── */
.reader-bar {
    background: rgba(8,8,10,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 14px 20px;
    color: var(--text-main);
}
.image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.image-container img {
    width: 100%;
    max-width: 800px;
    display: block;
    object-fit: contain;
}

/* ── Tags ── */
.genre-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-elevated);
    border: 1px solid var(--border-glass);
    color: var(--text-sub);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.genre-tag:active,
.genre-tag.active {
    background: var(--accent-subtle);
    border-color: var(--border-accent);
    color: var(--accent-light);
}

/* ── Toast ── */
.app-toast {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: var(--bg-elevated);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 9998;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: toastIn 0.2s ease;
    pointer-events: none;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Desktop Adaptasyon ── */
@media (min-width: 768px) {
    .app-card { width: 172px; }
    body { padding-bottom: 0; padding-left: 80px; }
    .app-nav { width: 72px; height: 100vh; flex-direction: column; top: 0; bottom: auto; border-right: 1px solid var(--border-glass); border-top: none; padding-bottom: 0; }
    .app-nav-inner { flex-direction: column; height: 100%; padding: 24px 0; gap: 4px; justify-content: flex-start; }
    .nav-item { flex: 0; width: 100%; padding: 10px; }
    .nav-label { font-size: 0.55rem; }
}
