/* -------------------------------------------------------------
   DESIGN SYSTEM & VARIABLES
   ------------------------------------------------------------- */
:root {
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Harmonious Private Banking Luxury Color Palette */
  --bg-app: #080c1a;
  --bg-sidebar: #050812;
  --surface-glass: rgba(16, 24, 48, 0.65);
  --surface-card: rgba(22, 32, 64, 0.8);
  --surface-hover: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(223, 195, 112, 0.4);

  --color-text-primary: #f8fafc;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;

  --color-gold: #dfc370;
  --color-gold-hover: #cfb159;
  --color-cyan: #00e5ff;
  --color-blue: #3b82f6;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  --blur-radius: 16px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 0 15px rgba(223, 195, 112, 0.25);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* -------------------------------------------------------------
   RESET & LAYOUT BASE
   ------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-app);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* -------------------------------------------------------------
   SIDEBAR STYLING
   ------------------------------------------------------------- */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding-left: 8px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--color-gold), #b5923b);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #050812;
  font-size: 1.25rem;
  box-shadow: var(--shadow-gold);
}

.brand-name h1 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--color-gold);
  line-height: 1.1;
}

.brand-name span {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 4px;
  color: var(--color-text-secondary);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  cursor: pointer;
}

.nav-item:hover {
  background-color: var(--surface-hover);
  color: var(--color-text-primary);
}

.nav-item.active {
  background-color: rgba(223, 195, 112, 0.1);
  color: var(--color-gold);
  border-left: 3px solid var(--color-gold);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding-left: 13px;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--color-gold);
  border: 1px solid rgba(223, 195, 112, 0.3);
}

.user-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.user-info p {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* -------------------------------------------------------------
   MAIN CONTENT AREA
   ------------------------------------------------------------- */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.top-header {
  height: 80px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.page-title h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
}

.page-title p {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.content-body {
  flex-grow: 1;
  padding: 40px;
  overflow-y: auto;
}

.view-pane {
  display: none;
  height: 100%;
}

.view-pane.active {
  display: block;
}

/* -------------------------------------------------------------
   BUTTONS & ACCENTS
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-body);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-gold), #b5923b);
  color: #050812;
  box-shadow: 0 4px 12px rgba(223, 195, 112, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ecd38c, var(--color-gold));
  box-shadow: 0 4px 20px rgba(223, 195, 112, 0.4);
}

.btn-secondary {
  background-color: var(--surface-hover);
  color: var(--color-text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.2);
}

.icon-btn {
  width: 16px;
  height: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-gold {
  background-color: rgba(223, 195, 112, 0.1);
  color: var(--color-gold);
  border: 1px solid rgba(223, 195, 112, 0.25);
}

.badge-blue {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--color-blue);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-warn {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* -------------------------------------------------------------
   THREE-PANE DASHBOARD
   ------------------------------------------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  height: 100%;
  align-items: stretch;
}

.pane-column {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
}

/* Glassmorphism Card Panels */
.card.glass {
  background-color: var(--surface-glass);
  backdrop-filter: blur(var(--blur-radius));
  -webkit-backdrop-filter: blur(var(--blur-radius));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.card.glass:hover {
  border-color: rgba(223, 195, 112, 0.2);
  box-shadow: var(--shadow-lg), 0 0 15px rgba(223, 195, 112, 0.05);
}

.card-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.card-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-gold);
}

.card-body {
  padding: 24px;
  flex-grow: 1;
}

.scrollable {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.scrollable::-webkit-scrollbar {
  width: 6px;
}

.scrollable::-webkit-scrollbar-track {
  background: transparent;
}

.scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* Loader animation */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
}

.loader::after {
  content: "";
  width: 32px;
  height: 32px;
  border: 2px dashed var(--color-gold);
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------
   DASHBOARD PANES CONTENT STYLES
   ------------------------------------------------------------- */
/* Pane 1: Timeline / Activity */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: var(--transition-fast);
  cursor: pointer;
}

.timeline-item:hover {
  background-color: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.08);
}

.timeline-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(223, 195, 112, 0.1);
  color: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timeline-icon.expense {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
}

.timeline-icon.income {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.timeline-content {
  flex-grow: 1;
}

.timeline-title {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* Pane 2: Upcoming Reminders */
.reminder-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reminder-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.02);
  border-left: 4px solid var(--color-gold);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.reminder-card.event {
  border-left-color: var(--color-blue);
}

.reminder-card.return_window {
  border-left-color: var(--color-warning);
}

.reminder-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.reminder-title {
  font-size: 0.9rem;
  font-weight: 500;
}

.reminder-date {
  font-size: 0.8rem;
  color: var(--color-gold);
  font-weight: 600;
}

.reminder-card.event .reminder-date {
  color: var(--color-blue);
}

.reminder-card.return_window .reminder-date {
  color: var(--color-warning);
}

.reminder-detail {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

/* Pane 3: Decisions & Reviews */
.decision-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.decision-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.decision-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-warning);
}

.decision-desc {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
  margin-bottom: 16px;
}

.decision-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.choice-btn:hover {
  background-color: var(--surface-hover);
  border-color: rgba(223, 195, 112, 0.3);
}

.choice-btn.primary-choice {
  border-color: rgba(223, 195, 112, 0.5);
  background-color: rgba(223, 195, 112, 0.03);
}

.choice-btn.primary-choice:hover {
  background-color: rgba(223, 195, 112, 0.08);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  text-align: center;
  color: var(--color-text-muted);
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* -------------------------------------------------------------
   TABLES & GENERAL PAGE VIEW DESIGN
   ------------------------------------------------------------- */
.view-header-desc {
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

.grid-card {
  width: 100%;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.ea-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.ea-table th {
  padding: 16px 20px;
  background-color: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--color-gold);
}

.ea-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  color: var(--color-text-primary);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ea-table tr:last-child td {
  border-bottom: none;
}

.ea-table tr {
  cursor: pointer;
  transition: var(--transition-fast);
}

.ea-table tr:hover td {
  background-color: var(--surface-hover);
}

.tx-amount {
  font-weight: 600;
}

.tx-amount.negative {
  color: var(--color-text-primary);
}

.tx-amount.positive {
  color: var(--color-success);
}

/* -------------------------------------------------------------
   MODAL OVERLAY (INGESTION SCREEN)
   ------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(5, 8, 18, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.modal-header h3 {
  font-family: var(--font-display);
  color: var(--color-gold);
  font-size: 1.35rem;
}

.modal-body {
  padding: 24px;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
  line-height: 1.4;
}

.dropzone {
  border: 2px dashed rgba(223, 195, 112, 0.3);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.01);
  cursor: pointer;
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--color-gold);
  background-color: rgba(223, 195, 112, 0.05);
}

.icon-upload {
  width: 48px;
  height: 48px;
  color: var(--color-gold);
  opacity: 0.8;
}

.text-link {
  color: var(--color-gold);
  text-decoration: underline;
}

.upload-progress-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 180px;
  overflow-y: auto;
}

.upload-progress-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.progress-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* -------------------------------------------------------------
   DETAIL DRAWER (SIDE-BY-SIDE SOURCE VIEWER)
   ------------------------------------------------------------- */
.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 580px;
  background-color: #0b0f20;
  border-left: 1px solid var(--border-color);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
  z-index: 900;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.detail-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  height: 80px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--color-gold);
}

.drawer-body {
  padding: 24px;
  flex-grow: 1;
  overflow-y: auto;
}

.btn-close {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-close:hover {
  color: var(--color-text-primary);
}

/* Side-by-Side Detail View Items */
.detail-section {
  margin-bottom: 24px;
}

.detail-section h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-gold);
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(223, 195, 112, 0.15);
  padding-bottom: 6px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.detail-row .label {
  color: var(--color-text-secondary);
}

.detail-row .value {
  font-weight: 500;
  text-align: right;
  max-width: 70%;
}

.source-content-box {
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 350px;
  overflow-y: auto;
  color: var(--color-text-secondary);
}

.line-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.line-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 8px;
  background-color: rgba(255, 255, 255, 0.01);
  border-radius: 4px;
}

/* -------------------------------------------------------------
   SETTINGS & FORMS
   ------------------------------------------------------------- */
.settings-section {
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.form-input {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.form-input:focus {
  border-color: var(--color-gold);
  outline: none;
  background-color: rgba(255, 255, 255, 0.04);
}

.settings-info {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* -------------------------------------------------------------
   TOAST SYSTEM
   ------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1100;
}

.toast {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background-color: #0b0f20;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-gold);
  color: var(--color-text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.success {
  border-left-color: var(--color-success);
}

.toast.error {
  border-left-color: var(--color-danger);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
