/*
 * app-shell.css — Sportify App Shell
 * Mengatur wadah phone yang rigid dan layout flex di dalamnya.
 * Wajib di-load SETELAH tokens.css di semua halaman.
 */

/* ─────────────────────────────────────────
   Reset minimal
───────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ─────────────────────────────────────────
   Scrollbar luar phone — selalu tersembunyi
   style.css (hanya dimuat di Socials/Community) sudah menyembunyikan
   scrollbar body via html { scrollbar-width: none }.
   Aturan ini memastikan perilaku yang sama di SEMUA halaman sehingga
   lebar viewport (dan posisi horizontal phone) tidak bergeser antar
   halaman yang load style.css vs yang tidak.
───────────────────────────────────────── */
html {
  scrollbar-width: none;
  overflow: hidden;
}
html::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* ─────────────────────────────────────────
   Typography — SF Pro rendering
───────────────────────────────────────── */
.app {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

/* ─────────────────────────────────────────
   Body — latar luar phone (desktop)
───────────────────────────────────────── */
body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--color-shell);
  font-family: var(--font);
  color: var(--color-text);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  /* Padding vertikal agar tombol fisik HP tidak kepotong saat di-scroll */
  padding: 32px 0;
}
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* ─────────────────────────────────────────
   .phone — wadah rigid iPhone
   overflow: visible agar pseudo-element tombol fisik
   bisa muncul di luar batas phone.
   Konten tetap terclip oleh .app { overflow: hidden }.
───────────────────────────────────────── */
.phone {
  width:         var(--phone-w);
  height:        var(--phone-h);
  position:      relative;
  overflow:      visible;            /* tombol fisik bisa keluar */
  border-radius: var(--phone-radius);
  box-shadow:    var(--phone-shadow);
  border:        var(--phone-border);
  flex-shrink:   0;
  transform:     translateZ(0);
}

/* ── Tombol Volume (kiri) — desktop only ── */
.phone::before {
  content:       '';
  position:      absolute;
  right:         100%;              /* tepat di luar sisi kiri phone */
  margin-right:  calc(-1 * var(--phone-frame-w) - 1px);
  top:           108px;
  width:         4px;
  height:        32px;
  background:    var(--phone-frame);
  border-radius: 2px 0 0 2px;
  /* dua tombol volume di bawahnya via box-shadow */
  box-shadow:
    0 46px 0 var(--phone-frame),   /* Volume Up */
    0 90px 0 var(--phone-frame);   /* Volume Down */
}

/* ── Tombol Power (kanan) — dihapus ── */
.phone::after {
  content: none;
}

/* ─────────────────────────────────────────
   .app — flex column pengisi penuh phone
   overflow: hidden di sini yang benar-benar
   mengclip konten agar tidak keluar phone.
───────────────────────────────────────── */
.app {
  width:         100%;
  height:        100%;
  display:       flex;
  flex-direction: column;
  overflow:      hidden;
  position:      relative;
  background:    var(--color-bg);
  border-radius: inherit;          /* ikuti corner phone */
}

/* ─────────────────────────────────────────
   Header — area atas yang tidak ikut scroll
───────────────────────────────────────── */
.app > header,
.app-header,
.top-fixed {
  flex-shrink: 0;
  z-index: 20;
}

/* ─────────────────────────────────────────
   .page-scroll — area scrollable utama
   Satu nama, dipakai semua halaman.
───────────────────────────────────────── */
.page-scroll,
.content-scroll,
.cards-scroll,
.chat-scroll,
.feed-scroll,
.profile-scroll,
.explore-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: var(--navbar-safe);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.page-scroll::-webkit-scrollbar,
.content-scroll::-webkit-scrollbar,
.cards-scroll::-webkit-scrollbar,
.chat-scroll::-webkit-scrollbar,
.feed-scroll::-webkit-scrollbar,
.profile-scroll::-webkit-scrollbar,
.explore-scroll::-webkit-scrollbar {
  display: none;
}

/* ─────────────────────────────────────────
   Navbar — selalu di dalam phone, bukan viewport
───────────────────────────────────────── */
.phone .sportify-navbar {
  position:  absolute;
  left:      50%;
  transform: translateX(-50%);
  bottom:    var(--navbar-bottom);
  z-index:   100;
}

/* ─────────────────────────────────────────
   App Header komponen standar
───────────────────────────────────────── */
.app-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding: 18px var(--page-px) 10px;
  min-height:      60px;
  background:      var(--color-bg);
  flex-shrink:     0;
  z-index:         20;
}

.app-header-left,
.app-header-right {
  display:     flex;
  align-items: center;
  gap:         var(--space-2);
}

.app-logo {
  display:     flex;
  align-items: center;
  height:      31px;
}

.app-logo img {
  display: block;
  height:  31px;
  width:   auto;
}

.app-icon-btn {
  width:           36px;
  height:          36px;
  border-radius:   var(--radius-md);
  background:      rgba(255, 255, 255, .06);
  border:          1px solid var(--color-border);
  display:         flex;
  align-items:     center;
  justify-content: center;
  color:           var(--color-text-dim);
  font-size:       16px;
  text-decoration: none;
  flex-shrink:     0;
}

.app-back {
  width:           34px;
  height:          34px;
  border-radius:   var(--radius-full);
  background:      rgba(255, 255, 255, .08);
  color:           var(--color-text);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       16px;
  text-decoration: none;
  flex-shrink:     0;
}

/* ─────────────────────────────────────────
   iPhone Chrome — Dynamic Island + Status Bar
   Dipakai oleh includes/iphone-chrome.php
───────────────────────────────────────── */
.iphone-top {
  position:       absolute;
  top:            0;
  left:           0;
  width:          100%;
  height:         var(--statusbar-h, 54px);
  z-index:        200;
  pointer-events: none;
  user-select:    none;
}

/* Dynamic Island — pill di tengah */
.dynamic-island {
  position:      absolute;
  top:           10px;
  left:          50%;
  transform:     translateX(-50%);
  width:         126px;
  height:        34px;
  background:    #000;
  border-radius: 20px;
  box-shadow:    0 0 0 1.5px rgba(255,255,255,0.08),
                 0 4px 12px rgba(0,0,0,0.6);
}

/* Status bar: jam kiri, icons kanan */
.status-bar {
  position:        absolute;
  top:             0;
  left:            0;
  width:           100%;
  height:          var(--statusbar-h, 54px);
  padding:         14px 20px 0;
  display:         flex;
  justify-content: space-between;
  align-items:     flex-start;
  color:           #fff;
  font-size:       13px;
  font-weight:     700;
  font-family:     var(--font);
  letter-spacing:  -0.2px;
}

.status-time {
  line-height: 1;
}

.status-icons {
  display:     flex;
  align-items: center;
  gap:         5px;
  font-size:   12px;
  margin-top:  1px;
}

/* Baterai — custom agar proporsional */
.status-battery {
  display:        flex;
  align-items:    center;
  gap:            1px;
  font-size:      12px;
  letter-spacing: 0;
}

/* Variasi warna status bar untuk halaman terang */
.iphone-top.dark .status-bar  { color: #000; }
.iphone-top.dark .dynamic-island { background: #000; }

/* ─────────────────────────────────────────
   Mobile — layar HP asli (<= 430px)
   Semua dekorasi frame disembunyikan.
───────────────────────────────────────── */
@media (max-width: 430px) {
  body {
    background:  #000;
    display:     block;
    overflow:    hidden;
    padding:     0;
  }

  .phone {
    width:         100vw;
    height:        100dvh;
    border-radius: 0;
    border:        none;
    box-shadow:    none;
    overflow:      hidden;
  }

  /* Tombol fisik tidak muncul di HP asli */
  .phone::before,
  .phone::after { display: none; }
}
