/* ==========================================================================
   DOMPET PRO — Modern Fintech Design System
   Mobile-First, Ultra Responsive & Ergonomic
   ========================================================================== */

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

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Primary & Brand Colors */
  --primary: #10b981;
  --primary-rgb: 16, 185, 129;
  --primary-hover: #059669;
  --primary-light: #ecfdf5;
  --primary-border: #a7f3d0;

  /* Income & Expense Accents */
  --income: #10b981;
  --income-bg: #ecfdf5;
  --income-border: #a7f3d0;
  --expense: #f43f5e;
  --expense-bg: #fff1f2;
  --expense-border: #fecdd3;
  --transfer: #0ea5e9;
  --transfer-bg: #f0f9ff;
  --transfer-border: #bae6fd;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;

  /* Neutral Surface & Backgrounds */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.85);
  
  /* Text & Border Colors */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Radii & Shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.07), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
  --shadow-float: 0 20px 35px -10px rgba(16, 185, 129, 0.35);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

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

button, input, select, textarea {
  font-family: inherit;
}

/* App Wrapper Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   SIDEBAR (DESKTOP)
   ========================================================================== */
.sidebar {
  width: 270px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: var(--transition-normal);
}

.sidebar-header {
  padding: 24px 24px 18px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.nav-link:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary-hover);
  border: 1px solid var(--primary-border);
}

.nav-link i {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background: #fafafa;
}

.mobile-connect-pill {
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition-fast);
}
.mobile-connect-pill:hover {
  background: #e2e8f0;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 90px; /* Space for mobile nav */
}

@media (min-width: 769px) {
  .main-wrapper {
    padding-bottom: 40px;
  }
}

/* Topbar Header */
.topbar {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.page-title h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.page-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Content Container */
.content-container {
  max-width: 1140px;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
}

@media (max-width: 640px) {
  .content-container {
    padding: 14px;
  }
}

/* ==========================================================================
   CARDS & FINTECH WIDGETS
   ========================================================================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Hero Balance Card (Atmosphere Gradient) */
.hero-balance-card {
  background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #10b981 100%);
  border-radius: var(--radius-xl);
  padding: 26px 24px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 32px -8px rgba(6, 78, 59, 0.45);
  margin-bottom: 22px;
}

.hero-balance-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-balance-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.hero-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-amount {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .hero-amount {
    font-size: 1.8rem;
  }
}

.hero-cashflow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.cashflow-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cashflow-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cashflow-icon.inc {
  background: rgba(255, 255, 255, 0.22);
  color: #a7f3d0;
}

.cashflow-icon.exp {
  background: rgba(255, 255, 255, 0.22);
  color: #fecdd3;
}

.cashflow-meta span {
  display: block;
  font-size: 0.725rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.cashflow-meta strong {
  font-size: 0.95rem;
  font-weight: 700;
}

/* Quick Action Buttons on Hero / Dashboard */
.quick-action-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

@media (max-width: 480px) {
  .quick-action-bar {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
}

.quick-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.quick-action-btn:active {
  transform: scale(0.95);
}

.quick-action-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.quick-btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.quick-btn-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
}

/* Modern Wallet Horizontal Slider */
.wallet-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.wallet-card-mini {
  flex: 0 0 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  cursor: pointer;
  transition: var(--transition-fast);
}

.wallet-card-mini:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.wallet-card-mini .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.wallet-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-card-subtle);
  color: var(--text-muted);
}

.wallet-card-mini .name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-card-mini .balance {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
}

/* ==========================================================================
   TRANSACTIONS LIST & ITEMS
   ========================================================================== */
.transactions-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.date-divider {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 4px 4px 4px;
}

.transaction-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: var(--transition-fast);
}

.transaction-card:hover {
  border-color: #cbd5e1;
  background: #fdfdfd;
}

.transaction-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.category-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.transaction-details {
  min-width: 0;
}

.transaction-category {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transaction-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.transaction-meta .wallet-pill {
  background: var(--bg-card-subtle);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.transaction-right {
  text-align: right;
  flex-shrink: 0;
}

.transaction-amount {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.transaction-amount.expense {
  color: var(--expense);
}

.transaction-amount.income {
  color: var(--income);
}

.transaction-amount.transfer {
  color: var(--transfer);
}

.transaction-time {
  font-size: 0.725rem;
  color: var(--text-subtle);
  margin-top: 2px;
}

/* ==========================================================================
   BUTTONS & FORM CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-subtle);
}

.btn-danger {
  background: var(--expense-bg);
  color: var(--expense);
  border-color: var(--expense-border);
}

.btn-danger:hover {
  background: #ffe4e6;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* Form Groups & Inputs */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.925rem;
  color: var(--text-main);
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.input-rupiah-wrapper {
  position: relative;
}

.input-rupiah-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-muted);
}

.input-rupiah {
  padding-left: 48px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

/* Type Toggle Buttons (Pengeluaran / Pemasukan / Transfer) */
.type-toggle-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg-card-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.type-toggle-btn {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.type-toggle-btn.active.expense {
  background: white;
  color: var(--expense);
  box-shadow: var(--shadow-sm);
}

.type-toggle-btn.active.income {
  background: white;
  color: var(--income);
  box-shadow: var(--shadow-sm);
}

.type-toggle-btn.active.transfer {
  background: white;
  color: var(--transfer);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & FLOATING ACTION BUTTON (FAB)
   ========================================================================== */
.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: center;
    z-index: 50;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    flex: 1;
    height: 100%;
    transition: color var(--transition-fast);
  }

  .bottom-nav-item i {
    width: 22px;
    height: 22px;
  }

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

  /* Center Floating Plus Button */
  .fab-center {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-float);
    margin-top: -24px;
    border: 3px solid white;
    cursor: pointer;
    transition: transform var(--transition-bounce);
  }

  .fab-center:active {
    transform: scale(0.9) rotate(90deg);
  }
}

/* ==========================================================================
   MODAL / BOTTOM SHEET (MOBILE ERGONOMIC)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-dialog {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-dialog {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 92vh;
    transform: translateY(100%);
  }

  .modal-overlay.active .modal-dialog {
    transform: translateY(0);
  }

  .bottom-sheet-handle {
    width: 40px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 99px;
    margin: 10px auto 4px auto;
  }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #fafafa;
}

/* ==========================================================================
   PROGRESS BARS & BADGES
   ========================================================================== */
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-success {
  background: var(--income-bg);
  color: var(--income);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--expense-bg);
  color: var(--expense);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

@media (max-width: 640px) {
  .toast-container {
    left: 20px;
    right: 20px;
    top: 16px;
  }
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideInDown 0.3s ease;
}

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

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
  .sidebar, .bottom-nav, .topbar, .btn, .modal-overlay, .fab-center {
    display: none !important;
  }
  body, .main-wrapper, .content-container {
    background: white !important;
    padding: 0 !important;
    margin: 0 !important;
  }
}
