/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --play-green: #01875f;
    --play-blue: #1a73e8;
    --play-dark: #202124;
    --play-gray: #5f6368;
    --play-light-gray: #dadce0;
    --play-bg: #f8f9fa;
    --play-white: #ffffff;
    --play-surface: #ffffff;
    --play-hover: #f1f3f4;
    --play-border: #e8eaed;
    --play-star: #e8710a;
    --font-google: 'Google Sans', 'Roboto', sans-serif;
    --font-roboto: 'Roboto', sans-serif;
    --shadow-sm: 0 1px 2px rgba(60,64,67,0.1);
    --shadow-md: 0 1px 6px rgba(60,64,67,0.15);
    --shadow-lg: 0 4px 16px rgba(60,64,67,0.2);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-roboto);
    background: var(--play-bg);
    color: var(--play-dark);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }

/* ===== Top Navigation ===== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--play-white);
    border-bottom: 1px solid var(--play-border);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-content {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    gap: 16px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--play-gray);
    transition: background 0.2s;
}

.menu-btn:hover { background: var(--play-hover); }

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.logo-text {
    font-family: var(--font-google);
    font-size: 22px;
    font-weight: 400;
    color: var(--play-gray);
}

.search-bar {
    flex: 1;
    max-width: 720px;
    height: 46px;
    background: var(--play-hover);
    border-radius: 24px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    transition: background 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}

.search-bar:focus-within {
    background: var(--play-white);
    box-shadow: var(--shadow-md);
    border-color: var(--play-border);
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 16px;
    font-family: var(--font-roboto);
    color: var(--play-dark);
    padding: 0 12px;
}

.search-bar input::placeholder { color: var(--play-gray); }

.search-icon, .mic-icon {
    color: var(--play-gray);
    cursor: pointer;
    font-size: 22px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    justify-content: flex-end;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--play-gray);
    transition: background 0.2s;
}

.icon-btn:hover { background: var(--play-hover); }

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--play-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-google);
}

/* ===== Sidebar ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.active { opacity: 1; visibility: visible; }

.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100%;
    background: var(--play-white);
    z-index: 1200;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.sidebar.active { left: 0; }

.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--play-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-family: var(--font-google);
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
}

.sidebar-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--play-dark);
}

.sidebar-email {
    font-size: 12px;
    color: var(--play-gray);
}

.sidebar-divider {
    height: 1px;
    background: var(--play-border);
    margin: 8px 0;
}

.sidebar-menu {
    list-style: none;
    padding: 8px 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    color: var(--play-dark);
    transition: background 0.2s;
}

.sidebar-item:hover { background: var(--play-hover); }

.sidebar-item.active {
    background: #e8f0fe;
    color: var(--play-blue);
}

.sidebar-item .material-icons {
    font-size: 24px;
    color: var(--play-gray);
}

.sidebar-item.active .material-icons { color: var(--play-blue); }

/* ===== Sub Navigation Tabs ===== */
.sub-nav {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--play-white);
    border-bottom: 1px solid var(--play-border);
    z-index: 900;
    display: flex;
    align-items: center;
}

.sub-nav-content {
    display: flex;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    gap: 8px;
    width: 100%;
}

.tab {
    padding: 12px 16px;
    border: none;
    background: none;
    font-family: var(--font-google);
    font-size: 14px;
    font-weight: 500;
    color: var(--play-gray);
    cursor: pointer;
    position: relative;
    border-radius: 8px 8px 0 0;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

.tab:hover {
    background: var(--play-hover);
    color: var(--play-dark);
}

.tab.active {
    color: var(--play-green);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 8px;
    right: 8px;
    height: 3px;
    background: var(--play-green);
    border-radius: 3px 3px 0 0;
}

/* ===== Main Content ===== */
.main-content {
    margin-top: 112px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 24px;
}

/* ===== Hero Banner ===== */
.hero-banner {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 32px;
    height: 220px;
}

.banner-slide {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.banner-slide.active { opacity: 1; }

.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 40px 48px;
    height: 100%;
    color: white;
}

.banner-text { max-width: 60%; }

.banner-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

.banner-text h2 {
    font-family: var(--font-google);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.banner-text p {
    font-size: 16px;
    opacity: 0.9;
}

.banner-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: background 0.3s, width 0.3s;
}

.dot.active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

/* ===== Sponsored Section ===== */
.sponsored-section {
    margin-bottom: 32px;
}

.sponsored-label {
    font-size: 12px;
    color: var(--play-gray);
    margin-bottom: 12px;
}

.sponsored-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--play-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--play-border);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.sponsored-card:hover { box-shadow: var(--shadow-md); }

.sponsored-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
}

.sponsored-info { flex: 1; }

.sponsored-info h3 {
    font-family: var(--font-google);
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.sponsored-info p {
    font-size: 13px;
    color: var(--play-gray);
}

.star-rating { color: var(--play-star); }

/* ===== Install Button ===== */
.install-btn {
    background: var(--play-green);
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 20px;
    font-family: var(--font-google);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    position: relative;
    overflow: hidden;
    min-width: 90px;
    text-align: center;
}

.install-btn:hover {
    background: #017a55;
    box-shadow: 0 1px 3px rgba(1,135,95,0.3);
}

.install-btn:active { transform: scale(0.96); }

.install-btn.large {
    padding: 12px 48px;
    font-size: 15px;
    border-radius: 24px;
    min-width: 140px;
}

.install-btn.installing {
    background: var(--play-border);
    color: var(--play-gray);
    pointer-events: none;
}

.install-btn.installed {
    background: transparent;
    color: var(--play-green);
    border: 1px solid var(--play-green);
}

.install-btn .progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--play-green);
    transition: width 0.3s ease;
    border-radius: 0 0 20px 20px;
}

/* ===== App Sections ===== */
.app-section {
    margin-bottom: 36px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-family: var(--font-google);
    font-size: 20px;
    font-weight: 500;
    color: var(--play-dark);
}

.section-arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--play-dark);
    transition: background 0.2s;
}

.section-arrow:hover { background: var(--play-hover); }

/* ===== App Row (Horizontal Scroll) ===== */
.app-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.app-row::-webkit-scrollbar { display: none; }

/* ===== App Card ===== */
.app-card {
    flex: 0 0 160px;
    cursor: pointer;
    scroll-snap-align: start;
    transition: transform 0.2s;
}

.app-card:hover { transform: translateY(-2px); }

.app-card-icon {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-xl);
    object-fit: cover;
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
    background: var(--play-hover);
}

.app-card-name {
    font-size: 13px;
    font-weight: 400;
    color: var(--play-dark);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-card-rating {
    font-size: 12px;
    color: var(--play-gray);
    display: flex;
    align-items: center;
    gap: 2px;
}

.app-card-rating .material-icons {
    font-size: 12px;
}

/* ===== List App Card (Top Charts) ===== */
.app-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}

.app-list-item:hover { background: var(--play-hover); }

.app-list-rank {
    font-size: 16px;
    font-weight: 500;
    color: var(--play-gray);
    min-width: 24px;
    text-align: center;
}

.app-list-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

.app-list-info { flex: 1; }

.app-list-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.app-list-meta {
    font-size: 12px;
    color: var(--play-gray);
}

/* ===== Categories Grid ===== */
.categories-grid {
    margin-bottom: 32px;
}

.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.cat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--play-white);
    border-radius: var(--radius);
    border: 1px solid var(--play-border);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.1s;
}

.cat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.cat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.cat-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--play-dark);
}

/* ===== App Detail Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 24px;
    overflow-y: auto;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.app-modal {
    background: var(--play-white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 920px;
    padding: 32px;
    position: relative;
    transform: translateY(30px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.modal-overlay.active .app-modal { transform: translateY(0); }

.modal-close {
    position: absolute;
    top: 16px;
    left: 16px;
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--play-gray);
    transition: background 0.2s;
    z-index: 1;
}

.modal-close:hover { background: var(--play-hover); }

.modal-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
    padding-top: 8px;
    margin-left: 48px;
}

.modal-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.modal-info h2 {
    font-family: var(--font-google);
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 4px;
}

.modal-developer {
    color: var(--play-green);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    cursor: pointer;
}

.modal-meta {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: var(--play-gray);
}

.modal-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    border-top: 1px solid var(--play-border);
}

.modal-meta span:first-child { font-weight: 500; }

.modal-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 0 48px 0 48px;
}

.wishlist-btn .material-icons { font-size: 24px; }

/* Screenshots */
.modal-screenshots {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 0 0 16px 0;
    margin-bottom: 24px;
    scrollbar-width: none;
}

.modal-screenshots::-webkit-scrollbar { display: none; }

.screenshot {
    flex: 0 0 auto;
    width: 180px;
    height: 320px;
    border-radius: var(--radius-lg);
    background: var(--play-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--play-border);
}

.screenshot .material-icons {
    font-size: 48px;
    color: var(--play-light-gray);
}

/* About */
.modal-about {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--play-border);
}

.modal-about h3,
.modal-ratings h3,
.modal-similar h3 {
    font-family: var(--font-google);
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 12px;
}

.modal-about p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--play-gray);
}

/* Ratings */
.modal-ratings {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--play-border);
}

.ratings-summary {
    display: flex;
    gap: 32px;
    align-items: center;
}

.ratings-big {
    font-size: 56px;
    font-family: var(--font-google);
    font-weight: 500;
    color: var(--play-dark);
    line-height: 1;
}

.ratings-bars {
    flex: 1;
    max-width: 300px;
}

.rating-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--play-gray);
}

.rating-row span:first-child { min-width: 12px; }

.rating-bar-bg {
    flex: 1;
    height: 12px;
    background: var(--play-border);
    border-radius: 6px;
    overflow: hidden;
}

.rating-bar-fill {
    height: 100%;
    background: var(--play-green);
    border-radius: 6px;
    transition: width 0.5s ease;
}

/* Similar apps */
.modal-similar { margin-bottom: 16px; }

.similar-apps {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.similar-apps::-webkit-scrollbar { display: none; }

/* ===== Install Toast ===== */
.install-toast {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--play-dark);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    z-index: 3000;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
}

.install-toast.show { bottom: 24px; }

.install-toast .material-icons {
    color: var(--play-green);
    font-size: 22px;
}

/* ===== Search Results ===== */
.search-results {
    margin-bottom: 32px;
}

.search-results-title {
    font-family: var(--font-google);
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 16px;
}

.no-results {
    text-align: center;
    padding: 48px 24px;
    color: var(--play-gray);
}

.no-results .material-icons {
    font-size: 64px;
    color: var(--play-light-gray);
    margin-bottom: 16px;
}

.no-results p {
    font-size: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav-content { padding: 0 12px; }
    .nav-left { min-width: auto; }
    .logo-text { display: none; }
    .nav-right { min-width: auto; }
    .main-content { padding: 12px; margin-top: 104px; }
    .hero-banner { height: 180px; margin-bottom: 20px; }
    .banner-content { padding: 20px; }
    .banner-text h2 { font-size: 20px; }
    .banner-image { display: none; }
    .app-card { flex: 0 0 130px; }
    .app-section { margin-bottom: 24px; }
    .section-title { font-size: 18px; }
    .sponsored-card { padding: 12px; gap: 12px; }
    .modal-overlay { padding: 0; }
    .app-modal { padding: 16px; border-radius: 0; min-height: 100vh; max-width: 100%; }
    .modal-close { top: 12px; left: 8px; }
    .modal-header { margin-left: 36px; gap: 12px; padding-top: 4px; }
    .modal-icon { width: 56px; height: 56px; }
    .modal-info h2 { font-size: 18px; }
    .modal-meta { gap: 12px; flex-wrap: wrap; }
    .modal-actions { padding: 0 0 0 36px; margin-bottom: 16px; }
    .install-btn.large { padding: 10px 32px; min-width: 120px; }
    .modal-screenshots { padding: 0 0 12px 0; gap: 8px; }
    .screenshot { width: 140px; height: 250px; }
    .modal-about, .modal-ratings, .modal-similar { margin-bottom: 16px; padding-bottom: 16px; }
    .modal-about h3, .modal-ratings h3, .modal-similar h3 { font-size: 16px; }
    .ratings-summary { gap: 16px; }
    .ratings-big { font-size: 42px; }
    .similar-apps { gap: 10px; }
    .sub-nav-content { padding: 0 12px; gap: 4px; }
    .tab { padding: 12px 10px; font-size: 13px; }
    .app-list-item { padding: 10px 8px; gap: 10px; }
    .app-list-icon { width: 48px; height: 48px; }
}

@media (max-width: 480px) {
    .search-bar { height: 40px; }
    .main-content { padding: 8px; }
    .hero-banner { height: 150px; margin-bottom: 16px; }
    .banner-content { padding: 16px; }
    .app-card { flex: 0 0 110px; }
    .app-row { gap: 10px; }
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
    .modal-header { gap: 10px; }
    .modal-icon { width: 48px; height: 48px; border-radius: 12px; }
    .modal-info h2 { font-size: 16px; }
    .modal-meta { font-size: 11px; }
    .screenshot { width: 120px; height: 213px; }
    .sponsored-icon { width: 44px; height: 44px; }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.app-section { animation: fadeIn 0.4s ease; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.installing-anim { animation: pulse 1.5s ease infinite; }
