/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Google Sans', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    color: #202124;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 60px;
}

/* ===== Loading State ===== */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8eaed;
    border-top-color: #01875f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* ===== Top Bar ===== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    height: 56px;
}

.top-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-bar-left {
    display: flex;
    align-items: center;
}

.gplay-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.gplay-logo {
    height: 40px;
    width: 40px;
}

.gplay-link h1 {
    font-size: 20px;
    font-weight: inherit;
    font-style: inherit;
    font-family: inherit;
    color: #5f6368;
    letter-spacing: -0.5px;
    margin: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: #f1f3f4;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1a73e8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-left: 8px;
}

.avatar-circle .material-icons-outlined {
    font-size: 20px;
}

/* ===== Main Content ===== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== App Header ===== */
.app-header {
    padding: 24px 0 16px;
}

.app-header-inner {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.app-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.app-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-name {
    font-size: 24px;
    font-weight: 500;
    color: #202124;
    line-height: 1.3;
}

.app-developer {
    font-size: 14px;
    color: #1a73e8;
    font-weight: 500;
}

.verified-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #5f6368;
    margin-top: 2px;
}

/* ===== Stats Row ===== */
.stats-row {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
    gap: 0;
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-value {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.stat-star {
    font-size: 16px;
    color: #202124;
}

.stat-label {
    font-size: 12px;
    color: #5f6368;
    margin-top: 2px;
}

.stat-divider {
    width: 1px;
    height: 28px;
    background: #dadce0;
}

/* ===== Install Section ===== */
.install-section {
    padding: 8px 0 16px;
}

.install-btn {
    width: 100%;
    height: 48px;
    background: #01875f;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    letter-spacing: 0.25px;
    transition: background 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.install-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent 0%,
        rgba(255, 255, 255, 0) 30%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 70%,
        transparent 100%
    );
    animation: shine 2.5s ease-in-out infinite;
}

@keyframes shine {
    0% { left: -100%; }
    60% { left: 120%; }
    100% { left: 120%; }
}

.install-btn:hover {
    background: #016848;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.install-btn:active {
    background: #015a3e;
}

.install-btn.installing {
    background: #01875f;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.install-btn.installing::after {
    display: none;
}

/* Installing progress bar animation */
.install-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: rgba(255,255,255,0.6);
    border-radius: 0 0 8px 8px;
    animation: installProgress 3s ease-out forwards;
}

@keyframes installProgress {
    0% { width: 0%; }
    20% { width: 15%; }
    40% { width: 35%; }
    60% { width: 60%; }
    80% { width: 85%; }
    100% { width: 100%; }
}

.install-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
}

/* Play button (after installed) */
.install-btn.installed {
    background: #01875f;
    pointer-events: auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.install-btn.installed::after {
    display: none;
}

.play-icon {
    font-size: 20px;
}

.share-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}

.text-icon-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #5f6368;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.text-icon-btn:hover {
    background: #f1f3f4;
}

.text-icon-btn .material-icons-outlined {
    font-size: 20px;
}

/* ===== Screenshots ===== */
.screenshots-section {
    padding: 16px 0;
}

.screenshots-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
}

.screenshots-scroll::-webkit-scrollbar {
    display: none;
}

.screenshot-card {
    flex: 0 0 auto;
    width: 220px;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    scroll-snap-align: start;
    background: #f1f3f4;
}

.screenshot-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== About Section ===== */
.about-section {
    padding: 24px 0 16px;
    border-top: 1px solid #e8eaed;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 500;
    color: #202124;
}

.about-text {
    font-size: 14px;
    color: #5f6368;
    line-height: 1.6;
    margin-bottom: 16px;
}

.tags-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    padding: 6px 16px;
    border: 1px solid #dadce0;
    border-radius: 20px;
    font-size: 13px;
    color: #5f6368;
}

/* ===== Updated Section ===== */
.updated-section {
    padding: 16px 0;
}

.updated-section h3 {
    font-size: 14px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 4px;
}

.updated-section p {
    font-size: 14px;
    color: #5f6368;
}

/* ===== Data Safety ===== */
.data-safety-section {
    padding: 24px 0 16px;
    border-top: 1px solid #e8eaed;
}

.safety-text {
    font-size: 14px;
    color: #5f6368;
    line-height: 1.6;
}

/* ===== Ratings ===== */
.ratings-section {
    padding: 24px 0 16px;
    border-top: 1px solid #e8eaed;
}

.verified-text {
    font-size: 12px;
    color: #5f6368;
    margin-bottom: 16px;
}

.ratings-overview {
    display: flex;
    gap: 32px;
    margin-bottom: 24px;
}

.rating-big {
    text-align: center;
    min-width: 80px;
}

.rating-number {
    font-size: 48px;
    font-weight: 400;
    line-height: 1.1;
    color: #202124;
}

.rating-stars {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 4px 0;
}

.star-filled {
    font-size: 14px;
    color: #01875f;
}

.rating-count {
    font-size: 12px;
    color: #5f6368;
}

.rating-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #5f6368;
}

.bar-row span {
    width: 12px;
    text-align: right;
}

.bar-track {
    flex: 1;
    height: 8px;
    background: #e8eaed;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: #01875f;
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* ===== Reviews ===== */
.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.review-card {
    padding: 0;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.reviewer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e8eaed;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: #5f6368;
}

.reviewer-name {
    font-size: 14px;
    font-weight: 500;
    color: #202124;
    flex: 1;
}

.review-menu {
    margin-left: auto;
}

.review-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.review-stars {
    display: flex;
    gap: 0;
}

.star-sm {
    font-size: 12px;
    color: #01875f;
}

.review-date {
    font-size: 12px;
    color: #5f6368;
}

.review-text {
    font-size: 14px;
    color: #202124;
    line-height: 1.5;
}

.see-all-link {
    display: inline-block;
    margin-top: 20px;
    font-size: 14px;
    font-weight: 500;
    color: #01875f;
}

.see-all-link:hover {
    text-decoration: underline;
}

/* ===== Footer ===== */
.page-footer {
    padding: 32px 0 16px;
    text-align: center;
    border-top: 1px solid #e8eaed;
    margin-top: 16px;
}

.disclaimer {
    font-size: 12px;
    color: #d93025;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    border-top: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    color: #5f6368;
    padding: 6px 12px;
    border-radius: 8px;
    transition: color 0.2s;
}

.nav-item .material-icons-outlined {
    font-size: 24px;
}

.nav-item.active {
    color: #01875f;
}

.nav-item:hover {
    color: #01875f;
}

/* ===== Install Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
}

.modal-header p {
    font-size: 13px;
    color: #5f6368;
}

.modal-text {
    font-size: 14px;
    color: #5f6368;
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 8px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.modal-btn.cancel {
    color: #01875f;
}

.modal-btn.cancel:hover {
    background: #e6f4ea;
}

.modal-btn.confirm {
    background: #01875f;
    color: #fff;
}

.modal-btn.confirm:hover {
    background: #016848;
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
    .main-content {
        padding: 0 24px;
    }

    .screenshot-card {
        width: 280px;
        height: 170px;
    }

    .stats-row {
        max-width: 600px;
    }

    .install-section {
        max-width: 100%;
    }
}

@media (min-width: 1024px) {
    .bottom-nav {
        display: none;
    }

    body {
        padding-bottom: 0;
    }

    .app-icon {
        width: 84px;
        height: 84px;
    }

    .app-name {
        font-size: 28px;
    }
}
