/* Mobile App Perfect - Clean No Conflicts */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #0f0f23;
  --bg-secondary: #1a1a2e;
  --card-bg: #16213e;
  --accent: #00d4ff;
  --text-primary: #ffffff;
  --text-secondary: #b8b8b8;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --border: 1px solid #333;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  line-height: 1.6;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary) !important;
}

/* APP HEADER */
.app-header {
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  padding: 1rem;
  box-shadow: var(--shadow);
  z-index: 200;
  position: sticky;
  top: 0;
}

.logo {
  height: 42px;
  width: auto;
  border-radius: 8px;
}

/* HERO SECTION */
.hero {
  height: 240px;
  margin: 1rem;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}

.hero .swiper {
  height: 100%;
}

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.swiper-pagination {
  bottom: 1rem !important;
}

.swiper-pagination-bullet {
  background: rgba(255,255,255,0.5);
  opacity: 1;
}

.swiper-pagination-bullet-active {
  background: var(--accent);
}

/* CONTENT GRID */
.content-section {
  flex: 1;
  padding: 1rem 1rem 120px 1rem; /* Bottom padding for nav */
}

.content-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 1.2rem;
  max-width: 100%;
}

.manga-card {
  background: var(--card-bg) !important;
  border-radius: 20px !important;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
}

.manga-card:hover, .manga-card:focus-within {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0,212,255,0.3);
}

.manga-card img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.manga-card:hover img {
  transform: scale(1.05);
}

.manga-card .title, .manga-card h3, .manga-card h4 {
  padding: 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary) !important;
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* PERFECT AD SLOTS */
.ad-slot {
  background: linear-gradient(135deg, rgba(0,212,255,0.1), rgba(26,26,46,0.8));
  border: 2px dashed var(--accent);
  border-radius: 20px;
  padding: 1.5rem;
  text-align: center;
  margin: 1.5rem auto;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  max-width: 100%;
}

.ad-leaderboard {
  height: 100px;
  min-width: 320px;
  display: block;
  margin: 1rem auto !important;
}

.ad-interstitial {
  height: 280px;
  max-width: 320px;
  margin: 2rem auto !important;
}

.ad-banner {
  height: 60px;
  max-width: 340px;
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
}

/* FIXED BOTTOM NAVIGATION - MOBILE APP STYLE */
.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
  background: rgba(15,15,35,0.98) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-top: 1px solid var(--accent) !important;
  display: flex !important;
  padding: 0.75rem 0.25rem !important;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.6) !important;
}

.nav-item {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--text-secondary) !important;
  text-decoration: none !important;
  padding: 0.3rem 0.1rem !important;
  transition: all 0.25s ease !important;
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  min-height: 50px;
}

.nav-item span {
  margin-top: 0.2rem;
  opacity: 0.9;
}

.nav-icon {
  font-size: 1.3rem !important;
  margin-bottom: 0rem !important;
  transition: all 0.2s ease !important;
}

.nav-item.active {
  color: var(--accent) !important;
}

.nav-item.active .nav-icon {
  text-shadow: 0 0 10px var(--accent);
  transform: scale(1.1);
}

.nav-item:active {
  transform: scale(0.95);
}

/* RESPONSIVE PERFECTION */
@media (max-width: 360px) {
  .content-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

@media (min-width: 480px) {
  .content-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .ad-leaderboard { width: 468px; height: 60px; }
}

@media (min-width: 768px) {
  .content-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .ad-leaderboard { width: 728px; height: 90px; }
}

/* PWA & iOS Safe Areas */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
  .app-header { padding-top: env(safe-area-inset-top); }
  .ad-banner { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

@media (display-mode: standalone) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}

/* Smooth Animations */
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.bottom-nav { animation: slideUp 0.4s ease-out; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.content-grid > * { animation: fadeInUp 0.6s ease-out forwards; }
