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

/* CSS Variables */
:root {
  --primary-color: #01875f; /* Google Play Green */
  --primary-hover: #00704e;
  --bg-color: #ffffff;
  --surface-color: #f1f3f4;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --border-color: #e8eaed;
  --shadow-color: rgba(0, 0, 0, 0.06);
  --star-color: #ffb300;
  --phone-border: #1e293b;
  --transition-speed: 0.35s;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 20px;
}

/* Phone Frame Mockup for Desktop */
.phone-container {
  width: 100%;
  max-width: 420px;
  height: 90vh;
  max-height: 860px;
  background-color: var(--bg-color);
  border: 12px solid var(--phone-border);
  border-radius: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Phone Status Bar */
.phone-status-bar {
  height: 38px;
  background-color: var(--bg-color);
  padding: 12px 24px 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  user-select: none;
  z-index: 20;
  border-bottom: 1px solid transparent;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-icons svg {
  width: 16px;
  height: 16px;
  fill: var(--text-primary);
}

/* Phone Home Indicator (iOS-like bottom bar) */
.phone-home-indicator {
  height: 24px;
  background-color: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  padding-bottom: 8px;
}

.home-bar {
  width: 134px;
  height: 5px;
  background-color: #cbd5e1;
  border-radius: 10px;
  transition: background-color 0.3s;
}

/* SPA Screen Area */
.phone-screen {
  flex: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Views Sliding Wrapper */
.views-wrapper {
  display: flex;
  width: 200%;
  height: 100%;
  transition: transform var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1);
}

.view {
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background-color: var(--bg-color);
  scrollbar-width: none; /* Firefox */
}

.view::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Active view states */
.view-active-storefront {
  transform: translateX(0);
}

.view-active-details {
  transform: translateX(-50%);
}

/* Custom Typography Headers */
h1, h2, h3 {
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
}

/* ==========================================
   VIEW A: STOREFRONT (Home)
   ========================================== */

/* Search Bar Mockup */
.search-bar-container {
  padding: 8px 16px;
  position: sticky;
  top: 0;
  background-color: var(--bg-color);
  z-index: 10;
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--surface-color);
  border-radius: 28px;
  padding: 8px 16px;
  gap: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.search-icon, .mic-icon {
  width: 20px;
  height: 20px;
  fill: var(--text-secondary);
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.search-bar input::placeholder {
  color: var(--text-secondary);
}

.search-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  padding: 2px;
}

.search-clear-btn svg {
  width: 18px;
  height: 18px;
  fill: var(--text-secondary);
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  user-select: none;
}

/* Category Tabs */
.tabs-container {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color);
  scrollbar-width: none;
  background-color: var(--bg-color);
  position: sticky;
  top: 60px;
  z-index: 10;
}

.tabs-container::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color 0.2s ease;
}

.tab.active {
  color: var(--primary-color);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 18px;
  right: 18px;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 3px 3px 0 0;
}

/* Hero Featured Game Banner */
.featured-hero {
  margin: 16px;
  border-radius: 16px;
  height: 160px;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.8) 100%), url('assets/mall_sprint_cover.png');
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  color: white;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transition: transform 0.2s ease;
}

.featured-hero:active {
  transform: scale(0.98);
}

.featured-tag {
  align-self: flex-start;
  background-color: var(--primary-color);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.featured-title {
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  line-height: 1.2;
}

.featured-subtitle {
  font-size: 12px;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  margin-top: 2px;
}

/* Games Grid Section */
.storefront-section-title {
  font-size: 18px;
  font-weight: 700;
  padding: 8px 16px 4px 16px;
}

.games-list {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Game Card Listing */
.game-card {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px 0;
  transition: background-color 0.2s;
  position: relative;
}

.game-card:active {
  background-color: rgba(0, 0, 0, 0.02);
}

.game-index {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  width: 24px;
  flex-shrink: 0;
}

.game-card-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.game-card-info {
  flex: 1;
  padding: 0 12px;
  overflow: hidden;
}

.game-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card-studio {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card-rating {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
}

.game-card-rating svg {
  width: 12px;
  height: 12px;
  fill: var(--text-secondary);
}

.get-button {
  background-color: var(--surface-color);
  color: var(--primary-color);
  border: none;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  flex-shrink: 0;
}

.game-card:hover .get-button,
.get-button:active {
  background-color: var(--primary-color);
  color: white;
}

/* ==========================================
   VIEW B: GAME DETAILS PAGE
   ========================================== */

/* Detail Navigation Header */
.detail-header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  background-color: var(--bg-color);
  z-index: 10;
}

.nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.nav-btn:active {
  background-color: var(--surface-color);
}

.nav-btn svg {
  width: 22px;
  height: 22px;
  fill: var(--text-primary);
}

/* Details App Card Section */
.detail-app-summary {
  display: flex;
  padding: 8px 16px 16px 16px;
  gap: 16px;
}

.detail-app-icon {
  width: 88px;
  height: 88px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.detail-app-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-app-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.detail-app-studio {
  font-size: 14px;
  color: var(--primary-color);
  font-weight: 600;
  margin-top: 4px;
}

.detail-app-badge {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Play Now Button */
.play-now-container {
  padding: 0 16px 16px 16px;
}

.play-now-btn {
  display: block;
  width: 100%;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(1, 135, 95, 0.2);
  transition: background-color 0.2s, transform 0.1s;
}

.play-now-btn:active {
  background-color: var(--primary-hover);
  transform: scale(0.99);
}

/* Stats Bar */
.detail-stats-bar {
  display: flex;
  margin: 8px 16px 20px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}

.stat-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background-color: var(--border-color);
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 3px;
}

.stat-value svg {
  width: 12px;
  height: 12px;
  fill: var(--text-primary);
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Horizontal Gallery Section */
.media-gallery-container {
  padding: 0 0 20px 0;
}

.media-gallery {
  display: flex;
  overflow-x: auto;
  padding: 0 16px;
  gap: 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.media-gallery::-webkit-scrollbar {
  display: none;
}

.gallery-image {
  width: 260px;
  height: 146px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  scroll-snap-align: start;
  box-shadow: 0 2px 8px var(--shadow-color);
  border: 1px solid var(--border-color);
}

/* About Game Section */
.about-section {
  padding: 0 16px 20px 16px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  cursor: pointer;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.section-header svg {
  width: 20px;
  height: 20px;
  fill: var(--text-secondary);
  transition: transform 0.2s;
}

.about-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-line;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag-chip {
  background-color: var(--surface-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid transparent;
}

/* Ratings & Reviews Section */
.reviews-section {
  padding: 20px 16px;
  border-top: 1px solid var(--border-color);
}

.reviews-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.rating-overview {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.overview-number-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.overview-big-num {
  font-family: 'Outfit', sans-serif;
  font-size: 48px;
  font-weight: 600;
  line-height: 1;
}

.overview-stars {
  display: flex;
  gap: 2px;
  margin-top: 6px;
}

.overview-stars svg {
  width: 12px;
  height: 12px;
  fill: var(--primary-color);
}

.overview-count {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.overview-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rating-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.rating-bar-num {
  width: 8px;
}

.rating-bar-track {
  flex: 1;
  height: 8px;
  background-color: var(--surface-color);
  border-radius: 4px;
  overflow: hidden;
}

.rating-bar-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 4px;
}

/* Reviews List */
.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.review-item {
  display: flex;
  flex-direction: column;
}

.review-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 4px var(--shadow-color);
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.review-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.review-stars {
  display: flex;
  gap: 2px;
}

.review-stars svg {
  width: 10px;
  height: 10px;
  fill: var(--star-color);
}

.review-date {
  font-size: 11px;
  color: var(--text-secondary);
}

.review-comment {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 6px;
}

/* ==========================================
   RESPONSIVE DESIGN (MOBILE ADAPTATION)
   ========================================== */

@media (max-width: 500px) {
  body {
    padding: 0;
    background: var(--bg-color);
  }

  .phone-container {
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  .phone-status-bar {
    padding-top: 16px;
    height: 44px;
  }

  .phone-home-indicator {
    display: none;
  }
}
