/**
 * PocketPadi — Minimalist SaaS Design System
 * Calm White Background, Restrained Sea Blue Accent, Clean Typography & Zero Visual Clutter
 */

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

:root {
  --bg-app: #F8FAFC;
  --bg-surface: #FFFFFF;
  --border-subtle: #E2E8F0;
  --border-light: #F1F5F9;
  
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  
  --sea-blue: #0284C7;
  --sea-blue-hover: #0369A1;
  --sea-blue-subtle: #F0F9FF;
  
  --danger-red: #EF4444;
  --danger-red-hover: #DC2626;
  --danger-red-subtle: #FEF2F2;
  
  --radius-xl: 18px;
  --radius-lg: 12px;
  --radius-md: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.font-outfit {
  font-family: 'Outfit', sans-serif;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Sidebar */
.app-sidebar {
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  transition: transform 0.2s ease;
}

@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  }
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-link:hover {
  background: #F1F5F9;
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--sea-blue-subtle);
  color: var(--sea-blue);
  font-weight: 600;
}

/* Main Workspace */
.app-main {
  margin-left: 240px;
  min-height: 100vh;
  padding: 36px 44px 64px 44px;
}

@media (max-width: 1024px) {
  .app-main {
    margin-left: 0;
    padding: 20px 20px 40px 20px;
  }
}

.app-container {
  max-width: 1140px;
  margin: 0 auto;
}

/* Minimalist Cards */
.clean-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.03), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
}

.shadow-2xs {
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

/* KPI Overview Card */
.kpi-card {
  padding: 22px 24px;
  background: var(--bg-surface);
}

.kpi-label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kpi-num {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Clean Sea Blue Buttons */
.btn-sea {
  background: var(--sea-blue);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.84rem;
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  cursor: pointer;
}

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

.btn-sea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Clean Chat Interface */
.chat-container {
  max-width: 960px;
  margin: 0 auto;
}

.chat-bubble {
  max-width: 84%;
  padding: 13px 17px;
  font-size: 0.88rem;
  line-height: 1.6;
  border-radius: 16px;
  word-break: break-word;
}

.bubble-user {
  align-self: flex-end;
  background: var(--sea-blue);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.bubble-user strong {
  color: #FFFFFF;
  font-weight: 600;
}

.bubble-padi {
  align-self: flex-start;
  background: #FFFFFF;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.bubble-padi strong {
  color: #0F172A;
  font-weight: 600;
}

/* Date Divider */
.date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 16px 0;
}

.date-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border-subtle);
  z-index: 1;
}

.date-divider span {
  position: relative;
  z-index: 2;
  background: var(--bg-surface);
  padding: 3px 12px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* Chat Session Date Card (Left Sidebar of AI Companion) */
.chat-session-btn {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-session-btn:hover {
  background: #F1F5F9;
}

.chat-session-btn.active {
  background: #FFFFFF;
  border-color: var(--border-subtle);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Transaction Confirmation Card inside Chat */
.receipt-card {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}

.receipt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.82rem;
}

.receipt-item:not(:last-child) {
  border-bottom: 1px dashed #E2E8F0;
}

.receipt-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #E0F2FE;
  color: #0369A1;
}

/* Modern Input Bar */
.ai-input-bar {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 28px;
  padding: 5px 8px 5px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-input-bar:focus-within {
  border-color: var(--sea-blue);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.ai-input-bar input {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.86rem;
  color: var(--text-primary);
  outline: none;
  padding: 4px 0;
}

.ai-input-bar input::placeholder {
  color: var(--text-muted);
}

/* Voice Toggle Button */
.btn-voice {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #64748B;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-voice:hover {
  background: #F1F5F9;
  color: var(--sea-blue);
}

.btn-voice.recording {
  background: var(--danger-red-subtle);
  color: var(--danger-red);
  animation: pulse 1.5s infinite;
}
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Subtle Suggestion Chips */
.suggestion-chip {
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 4px 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.suggestion-chip:hover {
  background: var(--sea-blue-subtle);
  border-color: #BAE6FD;
  color: var(--sea-blue);
}

/* Role Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: capitalize;
}

.role-badge-primary {
  background: #E0F2FE;
  color: #0284C7;
}

.role-badge-partner {
  background: #F0F9FF;
  color: #0369A1;
}

.role-badge-family {
  background: #F1F5F9;
  color: #475569;
}

.role-badge-dependent {
  background: #F1F5F9;
  color: #475569;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

/* Custom Scrollbars */
.clean-scroll::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
.clean-scroll::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 9999px;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* =========================================================================
   GEMINI-STYLE AI COMPANION (Borderless, Full-Page, Spacious & Clean)
   ========================================================================= */

body[data-page="ai-companion"] {
  background-color: #FFFFFF !important;
}

body[data-page="ai-companion"] .app-main {
  padding: 12px 24px 16px 24px;
}

body[data-page="ai-companion"] .app-container {
  max-width: 100% !important;
}

body[data-page="ai-companion"] #topAppHeader {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #F1F5F9;
}

.gemini-chat-shell {
  display: flex;
  width: 100%;
  height: calc(100vh - 96px);
  min-height: 540px;
  background: #FFFFFF;
  overflow: hidden;
  border: none;
  box-shadow: none;
}

/* Left History Sidebar */
.gemini-history-sidebar {
  width: 250px;
  background: #F8FAFC;
  border-right: 1px solid #F1F5F9;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-radius: 12px;
}

.gemini-new-chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  border-radius: 9999px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.gemini-new-chat-btn:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #0F172A;
}

.gemini-history-item {
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  color: #475569;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gemini-history-item:hover {
  background: #EDF2F7;
  color: #0F172A;
}

.gemini-history-item.active {
  background: #E2E8F0;
  color: #0F172A;
  font-weight: 600;
}

/* Main Chat Canvas */
.gemini-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #FFFFFF;
  min-width: 0;
}

.gemini-chat-topbar {
  padding: 8px 24px;
  border-bottom: 1px solid #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.gemini-chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px 20px;
}

.gemini-stream-inner {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Gemini Empty State */
.gemini-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px 20px 20px;
}

/* Messages */
.gemini-msg-row {
  display: flex;
  width: 100%;
}

.gemini-msg-row.user-msg {
  justify-content: flex-end;
}

.gemini-user-bubble {
  background: var(--sea-blue);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: 20px;
  border-bottom-right-radius: 4px;
  font-size: 0.88rem;
  line-height: 1.55;
  max-width: 78%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  word-break: break-word;
}

.gemini-user-bubble strong {
  color: #FFFFFF;
}

.gemini-msg-row.padi-msg {
  align-items: flex-start;
  gap: 14px;
  max-width: 90%;
}

.gemini-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.gemini-content {
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #1E293B;
  word-break: break-word;
}

.gemini-author {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94A3B8;
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

.gemini-text {
  color: #1E293B;
}

.gemini-text strong {
  color: #0F172A;
  font-weight: 600;
}

.gemini-receipt {
  margin-top: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px solid #F1F5F9;
  max-width: 440px;
}

.gemini-receipt-header {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.gemini-receipt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
}

.gemini-receipt-item:not(:last-child) {
  border-bottom: 1px dashed #E2E8F0;
}

.gemini-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0;
}

.gemini-date-divider span {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94A3B8;
  background: #F8FAFC;
  padding: 3px 12px;
  border-radius: 9999px;
  border: 1px solid #F1F5F9;
}

/* Prompt Bar */
.gemini-prompt-wrapper {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 8px 20px 14px 20px;
  flex-shrink: 0;
}

.gemini-prompt-bar {
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 28px;
  padding: 6px 8px 6px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.gemini-prompt-bar:focus-within {
  background: #FFFFFF;
  border-color: var(--sea-blue);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.gemini-prompt-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.88rem;
  color: #0F172A;
  padding: 6px 0;
}

.gemini-prompt-bar input::placeholder {
  color: #94A3B8;
}

.gemini-mic-btn {
  background: transparent;
  border: none;
  color: #64748B;
  padding: 7px;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.gemini-mic-btn:hover {
  color: var(--sea-blue);
  background: #E2E8F0;
}

.gemini-mic-btn.recording {
  color: #DC2626;
  background: #FEE2E2;
  animation: pulse 1.5s infinite;
}

.gemini-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  background: var(--sea-blue);
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.gemini-send-btn:hover {
  background: var(--sea-blue-hover);
}

.gemini-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gemini-disclaimer {
  font-size: 0.7rem;
  color: #94A3B8;
  text-align: center;
  margin-top: 8px;
}

/* =========================================================================
   MOBILE RESPONSIVENESS & PWA ENHANCEMENTS
   ========================================================================= */

/* Backdrop overlay for mobile drawer */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 39;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

/* Mobile Bottom Navigation Bar (Hidden - streamlined mobile view uses hamburger menu) */
.mobile-bottom-nav {
  display: none !important;
}

@media (max-width: 1024px) {
  .app-main {
    margin-left: 0;
    padding: 14px 14px 36px 14px;
  }

  /* Single clean mobile header for AI Companion: hide redundant dashboard header */
  body[data-page="ai-companion"] #topAppHeader {
    display: none !important;
  }

  body[data-page="ai-companion"] .app-main {
    padding: 0 !important;
  }

  .gemini-chat-shell {
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    position: relative;
  }

  /* On mobile, collapse left history sidebar in Gemini chat so canvas gets 100% width */
  .gemini-history-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 270px;
    z-index: 35;
    background: #FFFFFF;
    border-right: 1px solid var(--border-subtle);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
  }

  .gemini-history-sidebar.open {
    transform: translateX(0);
  }

  .gemini-chat-topbar {
    padding: 10px 14px;
    border-bottom: 1px solid #F1F5F9;
  }

  .gemini-chat-stream {
    padding: 10px 12px 16px 12px;
  }

  .gemini-prompt-wrapper {
    padding: 6px 10px 10px 10px;
  }

  .gemini-user-bubble {
    max-width: 90%;
    padding: 8px 14px;
    font-size: 0.84rem;
  }

  .gemini-msg-row.padi-msg {
    max-width: 100%;
    gap: 8px;
  }

  .gemini-content {
    font-size: 0.84rem;
  }
}

@media (max-width: 640px) {
  .kpi-card {
    padding: 12px 14px;
    border-radius: 12px;
  }

  .kpi-label {
    font-size: 0.66rem;
    margin-bottom: 4px;
  }

  .kpi-num {
    font-size: 1.25rem;
  }

  .kpi-sub {
    font-size: 0.68rem;
    margin-top: 4px;
  }

  .clean-card {
    border-radius: 14px;
  }
}

/* Full-Page Global App Loader (Desktop & Mobile Viewport) */
.global-app-loader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  background-color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-app-loader.hidden-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Print Styles for Bank-Grade Monthly Statements */
@media print {
  .app-sidebar,
  .mobile-bottom-nav,
  header,
  #headerMonthDropdownContainer,
  #profileDropdownContainer,
  button,
  .modal-overlay,
  .global-app-loader {
    display: none !important;
  }

  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  main {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .clean-card,
  .kpi-card {
    border: 1px solid #CBD5E1 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  #printableReportStatement {
    display: block !important;
    width: 100% !important;
  }
}

