/* ==========================================================================
   Safaricom M-PESA Native PWA Stylesheet
   ========================================================================== */

/* 1. Reset & Design Tokens */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  --color-primary: #00e676;
  --color-primary-dark: #00b359;
  --color-primary-light: rgba(0, 230, 118, 0.12);
  --color-cyan: #00b0ff;
  --color-red: #e53935;
  --bg-app: #121212;
  --bg-card: #1e1e1e;
  --bg-card-subtle: #242424;
  --border-card: rgba(255, 255, 255, 0.08);
  --text-main: #ffffff;
  --text-muted: #9e9e9e;
  --text-dim: #707070;
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Roboto", "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  background-color: #080908;
  font-family: var(--font-family);
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  color: var(--text-main);
}

/* 2. Main PWA Container */
.pwa-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  background-color: var(--bg-app);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.85), 0 0 1px rgba(0, 230, 118, 0.2);
}

@media (min-width: 481px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 30%, #151d16 0%, #080908 70%);
  }
  .pwa-container {
    height: 96vh;
    height: 96dvh;
    border-radius: 36px;
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
}

/* 3. Native App Header */
.native-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, var(--safe-top)) 18px 12px 18px;
  background-color: var(--bg-app);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 20;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 12px;
  transition: background-color 0.15s ease;
}

.header-profile:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
}

.avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7b1fa2, #4a148c);
  color: #ea80fc;
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(123, 31, 162, 0.4);
}

.verified-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background-color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-app);
}

.greeting-text {
  display: flex;
  flex-direction: column;
}

.greeting-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.2;
}

.greeting-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wave-hand {
  font-size: 16px;
  display: inline-block;
}

/* Header Action Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.install-pwa-btn {
  background: var(--color-primary-light);
  border: 1px solid rgba(0, 230, 118, 0.4);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.install-pwa-btn:hover {
  background: var(--color-primary);
  color: #000;
}

.header-btn {
  background: #1c1c1c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, background 0.15s ease;
}

.header-btn:active {
  transform: scale(0.92);
  background: #252525;
}

.bell-badge-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-red);
  box-shadow: 0 0 6px var(--color-red);
  border: 1.5px solid #1c1c1c;
}

/* 4. Scrollable App Content */
.native-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 85px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Custom scrollbar */
.native-content::-webkit-scrollbar {
  width: 5px;
}
.native-content::-webkit-scrollbar-track {
  background: transparent;
}
.native-content::-webkit-scrollbar-thumb {
  background: #252525;
  border-radius: 4px;
}

/* 5. Balance Carousel Section */
.native-balance-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.carousel-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.carousel-track::-webkit-scrollbar {
  display: none;
}

.native-card {
  flex: 0 0 75.5%;
  scroll-snap-align: start;
  border-radius: 22px;
  position: relative;
  transition: transform 0.2s ease;
}

.mpesa-card {
  background: #141a15 url('../assets/card1_mesh.svg?v=3') no-repeat right center / cover;
  border-radius: 22px;
  position: relative;
  box-shadow: -3px 0 16px rgba(0, 230, 118, 0.2), 0 4px 20px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.airtime-card {
  background: #131920 url('../assets/card2_mesh.svg?v=3') no-repeat right center / cover;
  border-radius: 22px;
  position: relative;
  box-shadow: -3px 0 16px rgba(0, 176, 255, 0.2), 0 4px 20px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

/* Precise Left-Edge Accent Glow matching mobile app */
.card-edge-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.card-inner {
  padding: 16px 16px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 168px;
  justify-content: space-between;
  position: relative;
  z-index: 3;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-label {
  font-size: 15px;
  font-weight: 600;
  color: #00c853;
  letter-spacing: 0.2px;
}

.card-label.cyan {
  color: var(--color-cyan);
}

.balance-display-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.balance-pill-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  min-height: 42px;
}

.balance-masked {
  display: flex;
  align-items: center;
}

.masked-pill-shape {
  width: 135px;
  height: 38px;
  background: #202522;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.balance-sub-blur {
  width: 200px;
  max-width: 65%;
  height: 14px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.09);
  filter: blur(5px);
  margin: 2px 0 6px 0;
  transition: opacity 0.2s ease;
}

.balance-sub-blur.hide {
  display: none;
}

.balance-revealed {
  display: none;
  align-items: baseline;
  gap: 6px;
  animation: fadeIn 0.2s ease-out;
}

.balance-revealed .currency {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
}

.balance-revealed .amount {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.balance-revealed.show {
  display: flex;
}
.balance-masked.hide {
  display: none;
}

.eye-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  outline: none;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.15s ease, background 0.15s ease;
}

.eye-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.eye-toggle-btn:active {
  transform: scale(0.9);
}

.btn-statements {
  width: 100%;
  padding: 11px 16px;
  background: transparent;
  border: 1.2px solid rgba(0, 200, 83, 0.45);
  border-radius: 14px;
  color: #00e676;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-statements:hover {
  background: rgba(0, 230, 118, 0.1);
}

.btn-statements:active {
  transform: scale(0.98);
}

.airtime-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.airtime-sub {
  font-size: 14px;
  color: var(--text-muted);
}

.airtime-amount {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.btn-topup {
  width: 100%;
  padding: 11px 16px;
  background: transparent;
  border: 1.2px solid #00c853;
  border-radius: 14px;
  color: #00e676;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-topup:hover {
  background: rgba(0, 176, 255, 0.1);
}

/* Carousel Dots */
.carousel-dots-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
}

.dot-btn {
  width: 14px;
  height: 5px;
  border-radius: 3px;
  background: #3e4440;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.25s ease;
}

.dot-btn.active {
  width: 26px;
  height: 5px;
  border-radius: 3px;
  background: #00c853;
}

/* 6. Quick Actions Card */
.native-quick-actions {
  background-color: #1b201d;
  border-radius: 22px;
  padding: 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 10px 4px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.view-all-link {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.view-all-link:hover {
  opacity: 0.8;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 2px;
}

.action-item {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 2px;
  border-radius: 12px;
  transition: transform 0.15s ease;
}

.action-item:active {
  transform: scale(0.92);
}

.action-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #232a25;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.action-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.action-item:hover .action-icon-wrap {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 230, 118, 0.25);
}

.action-label {
  font-size: 11px;
  font-weight: 500;
  color: #e0e0e0;
  text-align: center;
  line-height: 1.2;
}

/* 7. Frequents Section */
.native-frequents {
  background-color: var(--bg-card);
  border-radius: 20px;
  padding: 16px;
  border: 1px solid var(--border-card);
  position: relative;
}

.frequents-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.frequents-empty-hint {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 70%;
}

.support-agent-bubble {
  position: relative;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.support-agent-bubble:active {
  transform: scale(0.92);
}

.agent-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  display: block;
}

.agent-pulse-ring {
  display: none;
}

@keyframes pulseRing {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* 8. My Finances Section */
.native-finances {
  background-color: var(--bg-card);
  border-radius: 20px;
  padding: 16px;
  border: 1px solid var(--border-card);
}

.finances-scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 6px 2px;
}
.finances-scroll-row::-webkit-scrollbar {
  display: none;
}

.finance-card-tile {
  flex: 0 0 120px;
  background-color: #242825;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.finance-card-tile:active {
  transform: scale(0.95);
  background-color: #2b322c;
}

.tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
}

.tile-icon.green-bg {
  background: rgba(0, 230, 118, 0.15);
  color: var(--color-primary);
}

.tile-icon.green-text {
  background: #19201a;
  color: var(--color-primary);
  font-size: 13px;
}

.tile-icon.yellow-bg {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}

.tile-title {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  white-space: nowrap;
}

.tile-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.bottom-safe-spacer {
  height: 40px;
}

/* 9. Floating "Scan to pay" Button */
.floating-scan-container {
  position: absolute;
  bottom: max(20px, var(--safe-bottom));
  right: 20px;
  z-index: 50;
  pointer-events: auto;
}

.btn-scan-to-pay {
  background: #242a25;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  padding: 10px 20px 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-scan-to-pay:hover {
  background: #2d362e;
}

.btn-scan-to-pay:active {
  transform: scale(0.94);
}

.scan-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-btn-text {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* 10. Bottom Sheet Modal System */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-bottom-sheet {
  width: 100%;
  max-width: 480px;
  background: #1b1e1b;
  border-radius: 24px 24px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 20px max(24px, var(--safe-bottom)) 20px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-backdrop.open .modal-bottom-sheet {
  transform: translateY(0);
}

.modal-handle-bar {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 0 auto 12px auto;
}

.modal-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-sheet-title {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
}

.modal-sheet-close {
  background: #252825;
  border: none;
  color: #aaa;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.modal-sheet-close:hover {
  background: #333;
  color: #fff;
}

.modal-sheet-body {
  overflow-y: auto;
  font-size: 14px;
  color: #ddd;
  line-height: 1.5;
}

/* Statements list inside modal */
.statement-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.stmt-title {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
}
.stmt-date {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.stmt-amount {
  font-weight: 700;
  font-size: 15px;
}
.stmt-amount.credit {
  color: var(--color-primary);
}
.stmt-amount.debit {
  color: #ff5252;
}

/* 11. PWA Install Banner */
.pwa-install-banner {
  position: absolute;
  bottom: 80px;
  left: 16px;
  right: 16px;
  background: #222a23;
  border: 1px solid var(--color-primary);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 60;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  animation: slideUp 0.3s ease-out;
}

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

.pwa-banner-icon {
  flex-shrink: 0;
  border-radius: 10px;
}

.pwa-banner-info {
  flex: 1;
}

.pwa-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.pwa-banner-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.pwa-banner-btn {
  background: var(--color-primary);
  color: #000;
  border: none;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.pwa-banner-dismiss {
  background: transparent;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* 12. Toast Notification */
.native-toast {
  position: absolute;
  top: max(20px, var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(28, 36, 30, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.3s ease;
  white-space: nowrap;
}

.native-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
