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

:root {
  --bg-color: #f4f7fb;
  --text-color: #1e293b;
  --primary: #4361ee;
  --primary-hover: #3a56d4;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --accent: #f72585;
  --success: #10b981;
  --warning: #f59e0b;
}

/* Dark mode support if preferred */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: #1e293b;
    --border-color: #334155;
  }
}

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

body {
  background-color: #e2e8f0; /* Default outer background for desktop */
  color: var(--text-color);
  font-family: 'Outfit', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  body { background-color: #000; }
}

a { text-decoration: none; color: inherit; }

/* Mobile App Container */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  background-color: var(--bg-color);
  min-height: 100vh;
  box-shadow: 0 0 40px rgba(0,0,0,0.1);
  position: relative;
  /* Ruang untuk menu bawah tetap + safe area Android/iPhone. */
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.25rem 0.5rem 1.25rem;
}

.app-logo {
  height: 32px;
  object-fit: contain;
}

.chat-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
}

.chat-badge i {
  font-size: 18px;
}

/* Balance Card */
.balance-wrapper {
  padding: 0 1.25rem;
  margin-top: 10px;
}

.balance-card {
  background: linear-gradient(135deg, var(--primary), #7209b7);
  border-radius: 20px;
  padding: 20px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 25px rgba(67, 97, 238, 0.3);
  position: relative;
  overflow: hidden;
}

.balance-card::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}

.balance-info {
  z-index: 1;
}

.balance-label {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.balance-amount {
  font-size: 24px;
  font-weight: 700;
}

.balance-action {
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.btn-icon-circle {
  width: 45px;
  height: 45px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255,255,255,0.3);
  transition: all 0.2s;
  cursor: pointer;
}

.btn-icon-circle:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.05);
}

.action-label {
  font-size: 12px;
  font-weight: 500;
}

/* Banner */
.promo-banner {
  margin: 20px 1.25rem;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.promo-banner img {
  width: 100%;
  display: block;
  object-fit: cover;
}

/* Marquee */
.marquee-wrapper {
  margin: 0 1.25rem 20px 1.25rem;
  background: var(--card-bg);
  border-radius: 20px;
  padding: 8px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
  border: 1px solid var(--border-color);
}

.marquee-icon {
  color: var(--primary);
  font-size: 16px;
}

.marquee-content {
  overflow: hidden;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  flex: 1;
}

.marquee-content span {
  display: inline-block;
  animation: marquee 15s linear infinite;
}

@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* Categories */
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 1.25rem 15px 1.25rem;
  color: var(--text-color);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px 10px;
  padding: 0 1.25rem 25px 1.25rem;
}

.app-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.app-grid-item:hover {
  transform: translateY(-3px);
}

.app-icon-box {
  width: 55px;
  height: 55px;
  background: var(--card-bg);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
  border: 1px solid var(--border-color);
  color: var(--warning); /* Default icon color */
}

/* Icon specific colors */
.icon-blue { color: var(--primary); }
.icon-orange { color: #f97316; }
.icon-green { color: #10b981; }
.icon-purple { color: #a855f7; }
.icon-red { color: #ef4444; }

.app-grid-label {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  color: var(--text-color);
}

/* Bottom Nav */
.app-bottom-nav {
  /* Selalu menempel di bawah layar, bukan di ujung seluruh isi halaman. */
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border-top-left-radius: 25px;
  border-top-right-radius: 25px;
  box-shadow: 0 -5px 20px rgba(0,0,0,0.14);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-color);
  z-index: 999;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  flex: 1;
  transition: color 0.3s;
}

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

.nav-item i {
  font-size: 22px;
}

.nav-fab-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
}

.nav-fab {
  position: absolute;
  top: -35px;
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 8px 20px rgba(67, 97, 238, 0.4);
  border: 4px solid var(--bg-color);
  transition: transform 0.2s;
}

.nav-fab:hover {
  transform: scale(1.05);
}

/* General Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.form-control {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  color: var(--text-color);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.alert {
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #10b981;
}

/* Utils */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.p-4 { padding: 1rem; }
.glass-panel {
  background: var(--card-bg);
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
}


/* =========================================================
   Responsive layout v20 — mobile-first, tablet, dan desktop
   ========================================================= */
@media (min-width: 700px) and (max-width: 1023px) {
  body { background: var(--bg-color); }
  .app-container { max-width: 860px; }
  .app-bottom-nav { max-width: 860px; }
  .app-header { padding-left: 2rem; padding-right: 2rem; }
  .balance-wrapper,
  .promo-banner,
  .marquee-wrapper,
  .section-title,
  .app-grid { margin-left: 0; margin-right: 0; }
  .balance-wrapper,
  .app-grid { padding-left: 2rem; padding-right: 2rem; }
  .promo-banner,
  .marquee-wrapper,
  .section-title { margin-left: 2rem; margin-right: 2rem; }
}

@media (min-width: 1024px) {
  html, body { min-height: 100%; }
  body {
    background: var(--bg-color);
    overflow-x: hidden;
  }

  .app-container {
    width: calc(100% - 248px);
    max-width: none;
    min-height: 100vh;
    margin: 0 0 0 248px;
    box-shadow: none;
    background: var(--bg-color);
  }

  .app-header {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 26px 32px 18px;
  }

  .app-logo { height: 42px; }
  .chat-badge { padding: 9px 16px; font-size: 14px; }

  .app-bottom-nav {
    top: 0;
    bottom: 0;
    left: 0;
    transform: none;
    width: 248px;
    max-width: none;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 8px;
    padding: 30px 18px;
    border-radius: 0;
    border-top: 0;
    border-right: 1px solid var(--border-color);
    box-shadow: 8px 0 30px rgba(0,0,0,.08);
    overflow-y: auto;
  }

  .app-bottom-nav::before {
    content: 'NNpulsa';
    display: block;
    padding: 4px 14px 26px;
    color: var(--text-color);
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.02em;
  }

  .nav-item {
    flex: none;
    width: 100%;
    min-height: 52px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 13px;
    padding: 0 15px;
    border-radius: 15px;
    font-size: 14px;
    cursor: pointer;
  }

  .nav-item:hover,
  .nav-item.active {
    color: var(--primary);
    background: rgba(67,97,238,.11);
  }

  .nav-item i { width: 24px; font-size: 20px; text-align: center; }
  .nav-fab-wrapper { display: none; }

  .balance-card,
  .promo-banner,
  .marquee-wrapper,
  .app-grid-item,
  .product-card,
  .glass-panel {
    box-shadow: 0 10px 30px rgba(0,0,0,.06);
  }
}
