/* ==========================================================================
   ShortDramas Layout - Topbar, Mobile Header & Bottom Navigation
   ========================================================================== */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ==========================================================================
   Desktop Topbar
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(9, 10, 15, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px);
  transition: background 0.3s ease;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 36px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: #fff;
  text-decoration: none;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--brand-gradient);
  border-radius: 9px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(255, 45, 85, 0.4);
}

.brand-icon svg {
  width: 16px;
  height: 16px;
  fill: #fff;
  margin-left: 2px;
}

.brand-name span {
  color: var(--accent-pink);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 4px;
  position: relative;
  transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: #fff;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -18px;
  height: 3px;
  background: var(--brand-gradient);
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(255, 45, 85, 0.6);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-container {
  position: relative;
  width: clamp(200px, 20vw, 320px);
}

.search-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-full);
  font-size: 13.5px;
  color: #fff;
  transition: all 0.25s;
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--line-highlight);
  box-shadow: 0 0 0 3px rgba(255, 45, 85, 0.15);
}

.search-icon-svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

/* User & Coin widgets */
.coin-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 184, 0, 0.12);
  border: 1px solid rgba(255, 184, 0, 0.3);
  border-radius: var(--radius-full);
  color: #ffca38;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.coin-badge:hover {
  background: rgba(255, 184, 0, 0.22);
  transform: scale(1.03);
}

.coin-icon {
  width: 16px;
  height: 16px;
  background: var(--vip-gradient);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #000;
  font-size: 10px;
  font-weight: 900;
}

.notify-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-subtle);
  display: grid;
  place-items: center;
  color: var(--text-main);
  transition: all 0.2s;
}

.notify-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.notify-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: var(--accent-pink);
  border-radius: 50%;
  border: 2px solid var(--bg-main);
}

.avatar-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--line-subtle);
  cursor: pointer;
  background: #2a2035;
  transition: border-color 0.2s, transform 0.2s;
}

.avatar-btn:hover {
  border-color: var(--accent-pink);
  transform: scale(1.05);
}

.avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   Mobile Header
   ========================================================================== */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 99;
  height: 56px;
  padding: 0 16px;
  background: rgba(9, 10, 15, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-subtle);
  align-items: center;
  justify-content: space-between;
}

.mobile-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-search-trigger {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.07);
}

/* ==========================================================================
   Mobile Bottom Navigation Bar
   ========================================================================== */
.mobile-nav-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  height: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(14, 16, 24, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--line-subtle);
  justify-content: space-around;
  align-items: center;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  flex: 1;
  padding: 8px 0;
  transition: color 0.2s;
}

.tab-item:active {
  transform: scale(0.95);
}

.tab-item svg {
  width: 22px;
  height: 22px;
  transition: transform 0.2s, stroke 0.2s;
}

.tab-item.active {
  color: var(--accent-pink);
}

.tab-item.active svg {
  transform: translateY(-2px);
  color: var(--accent-pink);
}

.tab-item.vip-tab {
  color: var(--vip-gold);
}

.tab-item.vip-tab svg {
  color: var(--vip-gold);
}

/* ==========================================================================
   Main Content Container
   ========================================================================== */
.main-view {
  flex: 1;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 60px;
}

/* Responsive Rules */
@media (max-width: 1024px) and (min-width: 769px) {
  .topbar-left {
    gap: 18px;
  }
  .nav-links {
    gap: 14px;
  }
  .nav-link {
    font-size: 13px;
  }
  .search-container {
    width: 180px;
  }
}

@media (max-width: 900px) {
  .topbar-left {
    gap: 16px;
  }
  .nav-links {
    gap: 12px;
  }
  .nav-link {
    font-size: 12.5px;
  }
}

@media (max-width: 768px) {
  .topbar {
    display: none;
  }
  .mobile-topbar {
    display: flex;
  }
  .mobile-nav-bar {
    display: flex;
  }
  .main-view {
    padding: 14px 14px calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px) + 24px);
  }
}
