/*
 * Momentum - Base Application Styles
 * Dark slate theme with high contrast for financial data
 */

/* CSS Custom Properties - Change these to customize the entire theme */
:root {
  /* Color System - More vibrant and modern */
  --color-bg-primary: #0f172a;
  --color-bg-secondary: #1e293b;
  --color-bg-tertiary: #293548;
  --color-bg-hover: #334155;

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

  --color-border: #334155;
  --color-border-subtle: #1e293b;

  --color-positive: #10b981;
  --color-positive-bright: #34d399;
  --color-negative: #ef4444;
  --color-negative-bright: #f87171;
  --color-accent: #3b82f6;
  --color-accent-hover: #60a5fa;
  --color-accent-dark: #2563eb;
  --color-accent-darker: #1d4ed8;

  /* Spacing System */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 28px;
  --space-4xl: 32px;
  --space-5xl: 40px;
  --space-6xl: 48px;
  --space-7xl: 60px;

  /* Border Radius - More modern rounded corners */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows - Add depth */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow-positive: 0 0 20px rgba(16, 185, 129, 0.15);
  --shadow-glow-negative: 0 0 20px rgba(239, 68, 68, 0.15);
  --shadow-glow-accent: 0 0 20px rgba(59, 130, 246, 0.15);

  /* Typography */
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 13px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 32px;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.2;
  --line-height-normal: 1.6;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Responsive Breakpoints */
  --breakpoint-mobile: 640px;
  --breakpoint-tablet: 768px;
  --breakpoint-desktop: 1024px;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--font-size-3xl);
  letter-spacing: -0.025em;
}

h2 {
  font-size: var(--font-size-2xl);
  letter-spacing: -0.015em;
}

/* Links */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-base);
  font-weight: var(--font-weight-medium);
}

a:hover {
  color: var(--color-accent-hover);
}

/* Utility classes */
.positive {
  color: var(--color-positive-bright);
  font-weight: var(--font-weight-semibold);
}

.negative {
  color: var(--color-negative-bright);
  font-weight: var(--font-weight-semibold);
}

/* Cards */
.card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

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

.section {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3xl);
  margin-bottom: var(--space-2xl);
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.section-header h2 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  text-align: left;
  padding: var(--space-md) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

table td {
  padding: var(--space-md) var(--space-md);
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text-secondary);
}

table tbody tr {
  transition: all var(--transition-base);
}

table tbody tr:hover {
  background: var(--color-bg-tertiary);
  transform: scale(1.005);
}

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

/* Badges */
.badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.income {
  background: color-mix(in srgb, var(--color-positive-bright) 15%, transparent);
  color: var(--color-positive-bright);
  border: 1px solid color-mix(in srgb, var(--color-positive-bright) 30%, transparent);
}

.badge.expense {
  background: color-mix(in srgb, var(--color-negative-bright) 15%, transparent);
  color: var(--color-negative-bright);
  border: 1px solid color-mix(in srgb, var(--color-negative-bright) 30%, transparent);
}

/* Empty states */
.empty-state {
  padding: var(--space-7xl) var(--space-5xl);
  text-align: center;
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
}

.empty-state a {
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-base);
}

.empty-state a:hover {
  border-bottom-color: var(--color-accent);
}

/* Offline mode - Hide action columns in tables */
body.offline .transaction-table th:last-child,
body.offline .transaction-table td:last-child,
body.offline .assets-table th:last-child,
body.offline .assets-table td:last-child,
body.offline .snapshot-table th:last-child,
body.offline .snapshot-table td:last-child {
  display: none;
}

/* Offline indicator banner */
.offline-indicator {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-negative);
  color: white;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  z-index: 9999;
  transition: bottom var(--transition-slow);
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}

.offline-indicator i {
  font-size: var(--font-size-md);
}

body.offline .offline-indicator {
  bottom: 0;
  visibility: visible;
  opacity: 1;
}

body.online .offline-indicator {
  bottom: -80px;
  visibility: hidden;
  opacity: 0;
}

/* Mobile-specific improvements for better readability */
@media (max-width: 640px) {
  :root {
    /* Increase font sizes for mobile */
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 22px;
    --font-size-2xl: 26px;
    --font-size-3xl: 32px;

    /* Adjust spacing for mobile */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    --space-2xl: 24px;
    --space-3xl: 28px;
    --space-4xl: 32px;
  }

  html, body {
    font-size: 16px;
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
  }

  /* Prevent horizontal scrolling and swipe gestures on main content */
  body {
    overscroll-behavior-x: none;
    touch-action: pan-y pinch-zoom;
  }

  /* Ensure tables don't overflow */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent text overflow */
  * {
    max-width: 100%;
    word-wrap: break-word;
  }

  /* Ensure containers don't exceed viewport */
  .card,
  .section,
  .glass-card {
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* Ensure offline indicator is properly hidden on mobile */
  .offline-indicator {
    bottom: -100px;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-xs);
  }

  body.offline .offline-indicator {
    bottom: 0;
  }
}
