/* Dark/Light Theme Styles */
.dark-mode {
  background: linear-gradient(135deg, #18181b 0%, #27272a 100%) !important;
  color: #f3f4f6 !important;
}
.dark-mode h1,
.dark-mode h2,
.dark-mode h3,
.dark-mode h4 {
  color: #f3f4f6 !important;
}
.dark-mode input,
.dark-mode select {
  background: #27272a !important;
  color: #f3f4f6 !important;
  border-color: #444 !important;
}
.dark-mode .btn,
.dark-mode button {
  background: #444 !important;
  color: #f3f4f6 !important;
}
.dark-mode .stat-value.positive {
  color: #22c55e !important;
}
.dark-mode .stat-value.primary {
  color: #3b82f6 !important;
}
.dark-mode .stat-value.negative {
  color: #ef4444 !important;
}
.dark-mode .stat-value.networth-purple {
  color: #a855f7 !important;
}

/* Net Worth Purple Color */
.stat-value.networth-purple {
  color: #a855f7;
}
/* Modern Business-Ready Design System */
:root {
  /* Brand Colors */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --secondary: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;

  /* Neutral Colors */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo,
    monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),
    0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Global Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
}

/* Navigation */
nav {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 250px;
  z-index: 100;
}

.nav-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.nav-user {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: auto;
}

#nav-username {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.875rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

nav button {
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  width: 100%;
  text-align: left;
}

nav button:hover {
  background: white;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

#theme-toggle {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  width: 40px;
  height: 40px;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

#theme-toggle:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.05) !important;
}

/* Main Container */
main {
  max-width: 1200px;
  margin: 0 auto;
  margin-left: 250px;
  padding: var(--space-2xl);
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  padding: var(--space-xl);
  border-bottom: 1px solid var(--gray-200);
  background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
}

.card-content {
  padding: var(--space-xl);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-md) 0;
  font-weight: 700;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  color: var(--gray-900);
}

h2 {
  font-size: 2rem;
  color: var(--primary);
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h3 {
  font-size: 1.5rem;
  color: var(--gray-800);
}

h4 {
  font-size: 1.25rem;
  color: var(--gray-700);
  font-weight: 600;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
}

input,
select {
  padding: var(--space-md);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: all 0.2s ease;
  background: white;
  color: var(--gray-900);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input::placeholder {
  color: var(--gray-400);
}

/* Buttons */
.btn {
  padding: var(--space-md) var(--space-xl);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-danger {
  background: var(--danger);
  color: white;
  font-size: 0.75rem;
  padding: var(--space-xs) var(--space-sm);
  min-width: 60px;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

/* Ensure all add buttons in networth forms are same size in all themes */
#networth-forms .btn-success,
#networth-forms .btn-primary,
#networth-forms .btn-danger,
#networth-forms button.btn-success,
#networth-forms button.btn-primary,
#networth-forms button.btn-danger {
  width: 100%;
  font-size: 1.1rem;
  min-width: 120px;
  padding: var(--space-md) var(--space-xl);
  box-sizing: border-box;
}

/* Keep delete button red in dark mode */
.dark-mode .btn-danger,
.dark-mode button.btn-danger {
  background: #ef4444 !important;
  color: #fff !important;
  border: 1px solid #ef4444 !important;
}
.dark-mode .btn-danger:hover,
.dark-mode button.btn-danger:hover {
  background: #dc2626 !important;
}

/* Dark mode: add asset button green, add stock button blue, add debt button same size */
.dark-mode #networth-forms .btn-success,
.dark-mode #networth-forms button.btn-success {
  background: #22c55e !important;
  color: #fff !important;
  border: 1px solid #22c55e !important;
  width: 100%;
  font-size: 1.1rem;
}
.dark-mode #networth-forms .btn-primary,
.dark-mode #networth-forms button.btn-primary {
  background: #3b82f6 !important;
  color: #fff !important;
  border: 1px solid #3b82f6 !important;
  width: 100%;
  font-size: 1.1rem;
}
.dark-mode #networth-forms .btn-danger,
.dark-mode #networth-forms button.btn-danger {
  background: #ef4444 !important;
  color: #fff !important;
  border: 1px solid #ef4444 !important;
  width: 100%;
  font-size: 1.1rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: white;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 80px;
  overflow: hidden;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.stat-value {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 800;
  color: var(--gray-900);
  font-family: var(--font-mono);
  max-width: 100%;
  line-height: 1.1;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value.positive {
  color: var(--success);
}

.stat-value.negative {
  color: var(--danger);
}

.stat-value.primary {
  color: var(--primary);
}

.stat-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* Lists */
.list-container {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.list-header {
  background: var(--gray-50);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  color: var(--gray-800);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-md);
}

.list-header-meta {
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  min-width: 100px;
  justify-self: end;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--gray-100);
  transition: all 0.2s ease;
  gap: var(--space-md);
  min-height: 60px;
}

.list-item-actions {
  display: contents;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: var(--gray-50);
}

.list-item-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.list-item-title {
  font-weight: 600;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item-subtitle {
  font-size: 0.875rem;
  color: var(--gray-600);
}

.list-item-value {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-align: right;
  white-space: nowrap;
  min-width: 100px;
  justify-self: end;
}

/* Auth Section */
#auth-section {
  max-width: 400px;
  margin: var(--space-2xl) auto;
}

.auth-card {
  background: white;
  padding: var(--space-2xl);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
}

.auth-tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: var(--space-xs);
  margin-bottom: var(--space-xl);
}

.auth-tab {
  flex: 1;
  padding: var(--space-md);
  text-align: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Alert Messages */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin: var(--space-md) 0;
  font-weight: 500;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Loading States */
.loading {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--gray-300);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  nav {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    padding: var(--space-md);
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-features {
    flex-direction: row;
    order: 1;
    flex: 1;
    justify-content: center;
    gap: var(--space-sm);
  }

  .nav-user {
    flex-direction: row;
    order: 2;
    margin-top: 0;
    flex-shrink: 0;
  }

  nav button {
    width: auto;
    text-align: center;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.75rem;
  }

  main {
    margin-left: 0;
    padding: var(--space-lg) var(--space-md);
    margin: var(--space-lg) auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .list-item {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-sm);
    padding: var(--space-md);
  }

  .list-item-content {
    grid-row: 1;
  }

  .list-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    grid-row: 2;
  }

  .list-item-value {
    font-size: 0.85rem;
    text-align: left;
    min-width: auto;
    justify-self: start;
  }

  .list-header {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
    text-align: center;
  }

  .list-header-meta {
    text-align: center;
    justify-self: center;
  }
}

@media (max-width: 480px) {
  .stat-value {
    font-size: 1.25rem;
  }

  .list-item-value {
    font-size: 0.95rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Utility Classes */
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.font-mono {
  font-family: var(--font-mono);
}
.font-bold {
  font-weight: 700;
}
.text-sm {
  font-size: 0.875rem;
}
.text-lg {
  font-size: 1.125rem;
}
.text-xl {
  font-size: 1.25rem;
}
.hidden {
  display: none;
}
.flex {
  display: flex;
}
.grid {
  display: grid;
}
.gap-sm {
  gap: var(--space-sm);
}
.gap-md {
  gap: var(--space-md);
}
.gap-lg {
  gap: var(--space-lg);
}
.mt-lg {
  margin-top: var(--space-lg);
}
.mb-lg {
  margin-bottom: var(--space-lg);
}
.p-lg {
  padding: var(--space-lg);
}
.rounded {
  border-radius: var(--radius-md);
}
.shadow {
  box-shadow: var(--shadow-md);
}

/* Dark mode cards and containers */
.dark-mode .auth-card,
.dark-mode .card,
.dark-mode .list-container,
.dark-mode .stat-card,
.dark-mode .form-group,
.dark-mode #networth-forms,
.dark-mode #networth-lists,
.dark-mode .list-header,
.dark-mode .list-item,
.dark-mode main,
.dark-mode body {
  background: #18181b !important;
  color: #e5e7eb !important;
  border-color: #23272a !important;
}
.dark-mode input,
.dark-mode select,
.dark-mode button {
  background: #23272a !important;
  color: #e5e7eb !important;
  border-color: #444 !important;
}
.dark-mode .list-item-title,
.dark-mode .list-item-content {
  color: #c084fc !important;
}
.dark-mode .list-item-subtitle {
  color: #a1a1aa !important;
}
.dark-mode .list-item-value {
  color: #c084fc !important;
}
.dark-mode h1,
.dark-mode h2,
.dark-mode h3,
.dark-mode h4,
.dark-mode label {
  color: #e5e7eb !important;
}
.dark-mode input::placeholder {
  color: #a1a1aa !important;
}
