:root {
    --primary-grad: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    --bg-color: #F4F8FB;
    --white: #ffffff;
    --text-dark: #0f0f0f;
    --text-grey: #606060;
    --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 15px 35px rgba(0, 114, 255, 0.2);
    --yt-grey: #f2f2f2;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; -webkit-tap-highlight-color: transparent; }

body { background-color: #dfe6e9; display: flex; justify-content: center; align-items: center; height: 100vh; height: 100dvh; overflow: hidden; }

.app-container { width: 100%; max-width: 480px; height: 100%; background-color: var(--bg-color); position: relative; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 0 50px rgba(0,0,0,0.1); }

/* Tabs */
.tab-content { display: none; flex: 1; overflow-y: auto; padding-bottom: 140px; scrollbar-width: none; position: relative; z-index: 10; }
.tab-content::-webkit-scrollbar { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.scroll-bg-shape { position: absolute; top: 0; left: 0; width: 100%; height: 280px; background: var(--primary-grad); border-bottom-left-radius: 40px; border-bottom-right-radius: 40px; z-index: 0; }

.header-wrapper { position: relative; z-index: 100; width: 100%; background: transparent; }
.header-content { padding: 20px 25px; color: white; }
.top-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }

.profile-btn { width: 45px; height: 45px; background: rgba(255,255,255,0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; backdrop-filter: blur(5px); border: 1px solid rgba(255,255,255,0.3); }
.notif-badge { position: absolute; top: 10px; right: 12px; width: 8px; height: 8px; background: #ff4757; border-radius: 50%; display: none; border: 1px solid white; }

.search-box { background: white; border-radius: 20px; padding: 12px 20px; display: flex; align-items: center; gap: 10px; color: grey; box-shadow: 0 5px 15px rgba(0,0,0,0.05); cursor: pointer; }
.search-box span { font-size: 0.95rem; color: #999; }

/* Components */
.hero-section { position: relative; z-index: 20; margin-top: 10px; padding-left: 25px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; min-height: 200px; }
.hero-card { width: 85%; height: 200px; border-radius: 20px; overflow: hidden; position: relative; display: inline-block; margin-right: 15px; box-shadow: 0 10px 20px rgba(0,0,0,0.1); cursor: pointer; background: #ddd; }
.hero-img { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay { position: absolute; bottom: 0; width: 100%; padding: 15px; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); color: white; }

.channel-circle-card { display: inline-block; text-align: center; margin-right: 18px; cursor: pointer; width: 75px; vertical-align: top; }
.channel-circle-img-wrap { width: 65px; height: 65px; border-radius: 50%; border: 3px solid #0072ff; padding: 2px; background: white; display: inline-block; overflow: hidden; box-shadow: var(--shadow-soft); }
.channel-circle-img-wrap img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.channel-circle-name { font-size: 0.75rem; font-weight: 600; color: var(--text-dark); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Categories */
.category-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 20px 25px; scrollbar-width: none; position: relative; z-index: 5; }
.cat-pill { padding: 8px 20px; background: white; color: #666; border-radius: 30px; font-size: 0.9rem; white-space: nowrap; box-shadow: var(--shadow-soft); cursor: pointer; transition: 0.2s; border: 1px solid transparent; }
.cat-pill.active { background: var(--primary-grad); color: white; box-shadow: 0 5px 15px rgba(0, 114, 255, 0.3); }

/* Portrait Poster Cards */
.section-header { padding: 0 25px; display: flex; justify-content: space-between; margin-bottom: 12px; align-items: center; position: relative; z-index: 5;}
.movie-row { display: flex; overflow-x: auto; padding: 0 25px 15px; gap: 15px; scrollbar-width: none; min-height: 150px; position: relative; z-index: 5; }

.poster-card { min-width: 130px; height: 190px; border-radius: 15px; overflow: hidden; position: relative; background: #eee; cursor: pointer; box-shadow: var(--shadow-soft); transition: transform 0.2s; }
.poster-card:active { transform: scale(0.95); }
.poster-card img { width: 100%; height: 100%; object-fit: cover; }

/* YOUTUBE STYLE FEED */
.youtube-card-feed { display: flex; flex-direction: column; gap: 20px; padding: 0 20px; width: 100%; }
.youtube-card { width: 100%; background: white; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-soft); cursor: pointer; transition: transform 0.2s; border: 1px solid #f0f0f0; }
.youtube-card:active { transform: scale(0.98); }

.youtube-thumbnail-wrap { width: 100%; aspect-ratio: 16/9; position: relative; background: #eaeaea; overflow: hidden; }
.youtube-thumbnail-img { width: 100%; height: 100%; object-fit: cover; }

.youtube-play-badge { position: absolute; bottom: 12px; right: 12px; background: rgba(0, 0, 0, 0.8); color: white; padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 500; display: flex; align-items: center; gap: 5px; }

.youtube-card-body { padding: 15px; display: flex; gap: 12px; align-items: flex-start; }
.youtube-channel-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-grad); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; font-size: 1.1rem; border: 1px solid #e0e0e0; }

.youtube-card-info { flex: 1; }
.youtube-card-title { font-size: 0.95rem; font-weight: 600; color: var(--text-dark); line-height: 1.4; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.youtube-card-meta { font-size: 0.8rem; color: var(--text-grey); display: flex; align-items: center; gap: 6px; }
.youtube-category-badge { background: #f0f3f6; color: #0072ff; padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 500; }

/* Bottom Nav */
.bottom-nav { position: absolute; bottom: 0; width: 100%; height: 80px; background: rgba(255,255,255,0.95); display: flex; justify-content: space-around; align-items: center; border-radius: 30px 30px 0 0; z-index: 150; box-shadow: 0 -5px 20px rgba(0,0,0,0.05); backdrop-filter: blur(10px); }
.nav-item { font-size: 1.4rem; color: #b2bec3; cursor: pointer; transition: 0.3s; width: 50px; height: 50px; display: flex; justify-content: center; align-items: center; }
.nav-item.active { color: #0072ff; transform: translateY(-5px); }

/* Overlays & Screens */
.overlay-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-color); z-index: 200; transform: translateY(100%); transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); overflow-y: auto; padding-bottom: 50px; }
.overlay-screen.open { transform: translateY(0); }

/* DETAILS PAGE STYLE */
#details-screen { z-index: 300; background: var(--white); }
.youtube-player-sticky { position: sticky; top: 0; width: 100%; aspect-ratio: 16/9; background: #000; z-index: 250; box-shadow: 0 4px 10px rgba(0,0,0,0.15); }

.back-btn-youtube { position: absolute; top: 15px; left: 15px; width: 35px; height: 35px; background: rgba(0,0,0,0.5); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 260; border: none; font-size: 1rem; }
.back-btn-youtube:active { transform: scale(0.9); }

.youtube-detail-scroll { padding-bottom: 120px; overflow-y: auto; height: calc(100% - 16/9); }

.yt-action-row { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; scrollbar-width: none; }
.yt-action-row::-webkit-scrollbar { display: none; }

.yt-pill { display: flex; align-items: center; gap: 6px; background: var(--yt-grey); padding: 8px 16px; border-radius: 18px; font-size: 0.8rem; font-weight: 500; cursor: pointer; color: var(--text-dark); flex-shrink: 0; transition: background 0.2s; }
.yt-pill:active { background: #e0e0e0; }
.yt-pill.liked { background: rgba(255, 71, 87, 0.15); color: #ff4757; }

/* Subscribe bar */
.yt-channel-bar { display: flex; align-items: center; justify-content: space-between; padding: 4px 16px 12px 16px; border-bottom: 1px solid #e5e2e2; }
.yt-channel-bar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.channel-meta-left { display: flex; align-items: center; gap: 10px; }
.yt-subscribe-btn { background: var(--text-dark); color: var(--white); border: none; padding: 8px 16px; border-radius: 18px; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.yt-subscribe-btn:active { transform: scale(0.96); }
.yt-subscribe-btn.subscribed { background: var(--yt-grey); color: var(--text-dark); }

/* Comments Box Preview */
.yt-comments-box { background: var(--yt-grey); margin: 0 16px 15px 16px; padding: 12px; border-radius: 12px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; }

.comments-list { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; max-height: 250px; overflow-y: auto; padding-right: 5px; }
.comment-item { background: white; padding: 12px 15px; border-radius: 12px; box-shadow: var(--shadow-soft);  }
.comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.comment-user { font-size: 0.85rem; font-weight: 600; color: var(--text-dark); }
.comment-date { font-size: 0.7rem; color: var(--text-grey); }
.comment-text { font-size: 0.85rem; color: #4a5568; line-height: 1.4; }

.comment-input-area { display: flex; gap: 10px; margin-top: 15px; }
.comment-input { flex: 1; padding: 12px 15px; border-radius: 12px; border: 1px solid #e2e8f0; outline: none; font-size: 0.9rem; background: white; }
.comment-submit-btn { width: 45px; height: 45px; border: none; background: var(--primary-grad); color: white; border-radius: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* Notifications */
.notification-item { background: white; padding: 15px; border-radius: 15px; margin-bottom: 10px; box-shadow: var(--shadow-soft); border-left: 4px solid #0072ff; cursor: pointer; transition: transform 0.2s, background 0.2s; }
.notification-item:active { transform: scale(0.98); background: #f0f8ff; }
.notif-msg-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; color: #636e72; font-size: 0.9rem; line-height: 1.5; margin-top: 5px; }
.notif-date { font-size: 0.75rem; color: #999; display: block; margin-top: 8px; text-align: right; }

/* Profile Area */
.profile-header-wrap { padding: 40px 25px 30px; background: white; border-radius: 0 0 30px 30px; text-align: center; box-shadow: var(--shadow-soft); }
.menu-list { padding: 25px; padding-bottom: 50px; }
.menu-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background: white; border-radius: 15px; margin-bottom: 15px; cursor: pointer; box-shadow: 0 5px 10px rgba(0,0,0,0.03); transition: 0.2s; }
.menu-item:active { transform: scale(0.98); }
.menu-left { display: flex; align-items: center; gap: 15px; font-weight: 500; color: var(--text-dark); }
.menu-icon { width: 35px; height: 35px; border-radius: 10px; background: rgba(0, 114, 255, 0.1); color: #0072ff; display: flex; align-items: center; justify-content: center; }

/* Auth Form */
.auth-container { display: flex; flex-direction: column; justify-content: center; height: 100%; padding: 30px 25px; background: var(--bg-color); }
.auth-logo { text-align: center; margin-bottom: 30px; }
.auth-logo i { font-size: 3rem; color: #0072ff; }
.auth-logo h2 { font-size: 1.6rem; margin-top: 10px; }
.auth-form-group { margin-bottom: 18px; }
.auth-form-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; font-weight: 500; color: var(--text-dark); }
.auth-input { width: 100%; padding: 12px 18px; border: 1px solid #ddd; border-radius: 15px; background: white; outline: none; transition: 0.3s; }
.auth-input:focus { border-color: #0072ff; }
.auth-btn { width: 100%; padding: 14px; border: none; border-radius: 15px; background: var(--primary-grad); color: white; font-weight: 600; cursor: pointer; box-shadow: 0 5px 15px rgba(0, 114, 255, 0.2); }
.auth-switch { text-align: center; margin-top: 15px; font-size: 0.9rem; color: var(--text-grey); cursor: pointer; }

.ad-container { margin: 15px 25px; border-radius: 15px; overflow: hidden; background: #e0e0e0; display: none; justify-content: center; align-items: center; min-height: 60px; text-align: center; }

.sub-page-content { padding: 90px 25px 100px; }
.sub-page-title { font-size: 1.8rem; color: var(--text-dark); margin-bottom: 20px; }

.search-header-wrap { padding: 25px; display: flex; gap: 15px; align-items: center; background: white; box-shadow: var(--shadow-soft); position: sticky; top: 0; z-index: 10; }
.real-search-input { border: none; outline: none; width: 100%; font-size: 1.1rem; color: var(--text-dark); background: transparent; }
.search-results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 20px 25px; }

.fav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 20px; }

.skeleton { background: #eee; background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%); background-size: 200% 100%; animation: 1.5s shine linear infinite; border-radius: 15px; }
@keyframes shine { to { background-position-x: -200%; } }

.custom-toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(50px); background: rgba(33, 33, 33, 0.95); color: white; padding: 12px 25px; border-radius: 50px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); display: flex; align-items: center; gap: 12px; opacity: 0; pointer-events: none; transition: all 0.4s; z-index: 3000; font-size: 0.9rem; white-space: nowrap; }
.custom-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.custom-toast i { color: #00c6ff; font-size: 1.1rem; }
.custom-toast.error i { color: #ff4757; }

.channel-info-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; background: white; border-radius: 15px; box-shadow: var(--shadow-soft); }
.channel-info-bar img { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; }
.sub-btn.subscribed { background: var(--yt-grey); color: var(--text-dark); border: none; padding: 8px 16px; border-radius: 18px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }

.back-btn { position: absolute; top: 20px; left: 20px; width: 40px; height: 40px; background: rgba(255,255,255,0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 100; backdrop-filter: blur(5px); color: white; border: 1px solid rgba(255,255,255,0.3); }
.back-btn.dark { background: rgba(0,0,0,0.05); color: var(--text-dark); border: 1px solid rgba(0,0,0,0.1); }

@keyframes popUp { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ================== RESPONSIVE TABLET & DESKTOP STYLES ================== */
@media (min-width: 768px) {
    body { background-color: #dfe6e9; padding: 20px; }
    .app-container { max-width: 1100px; height: 95vh; border-radius: 24px; box-shadow: 0 25px 60px rgba(0,0,0,0.15); }
    .bottom-nav { width: calc(100% - 40px); max-width: 500px; left: 50%; transform: translateX(-50%); bottom: 20px; border-radius: 35px; height: 70px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); border: 1px solid rgba(255,255,255,0.4); }
    .tab-content { padding-bottom: 110px; }
    .hero-section { padding-left: 35px; }
    .hero-card { width: 45%; height: 240px; }
    .movie-row { padding: 0 35px 20px; }
    .poster-card { min-width: 150px; height: 220px; }
    .category-scroll { padding: 20px 35px; }
    .section-header { padding: 0 35px; }
    .youtube-card-feed { display: grid; grid-template-columns: repeat(2, 1fr); gap: 25px; padding: 0 35px; }
    .fav-grid, .search-results-grid { grid-template-columns: repeat(4, 1fr); gap: 15px; padding: 0 35px; }
    .custom-toast { bottom: 110px; }
}

@media (min-width: 1024px) {
    .app-container { max-width: 1250px; height: 92vh; }
    .hero-card { width: 32%; height: 260px; }
    .poster-card { min-width: 170px; height: 250px; }
    .youtube-card-feed { grid-template-columns: repeat(3, 1fr); }
    .fav-grid, .search-results-grid { grid-template-columns: repeat(5, 1fr); }

    /* Desktop Specific Layout for Details View */
    #details-screen { display: flex; flex-direction: row; align-items: stretch; padding-bottom: 0; }
    .youtube-player-sticky { position: relative; width: 60%; height: auto; aspect-ratio: 16/9; align-self: center; border-radius: 20px; margin: 30px; flex-shrink: 0; overflow: hidden; box-shadow: 0 15px 35px rgba(0,0,0,0.2); }
    .youtube-detail-scroll { flex: 1; height: 100%; overflow-y: auto; padding: 30px 25px 120px; border-left: 1px solid rgba(0,0,0,0.06); }
    #d-title { padding: 0 0 10px 0; font-size: 1.4rem; }
    #yt-info-card { margin: 5px 0 15px 0; }
    .yt-channel-bar { padding: 10px 0 15px 0; }
    .yt-action-row { padding: 12px 0; }
    .yt-comments-box { margin: 0 0 15px 0; }
    #comment-sheet { padding: 0; }
    .back-btn-youtube { top: 25px; left: 25px; width: 45px; height: 45px; font-size: 1.2rem; }
}