/**
 * Account Management & Net Worth Dashboard Styles
 * Issue #337: Multi-Account Liquidity Management
 */

/* ============================================
   Dashboard Layout
   ============================================ */

.accounts-dashboard {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.dashboard-header h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary, #ffffff);
}

.dashboard-header h2 i {
  color: var(--primary-color, #667eea);
}

/* ============================================
   Net Worth Overview Card
   ============================================ */

.net-worth-overview {
  margin-bottom: 2rem;
}

.net-worth-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 2rem;
  color: white;
  box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.net-worth-main {
  text-align: center;
  margin-bottom: 2rem;
}

.net-worth-main .label {
  display: block;
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.net-worth-main .amount {
  display: block;
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.net-worth-main .change {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 500;
}

.net-worth-main .change.positive {
  background: rgba(0, 200, 83, 0.25);
}

.net-worth-main .change.negative {
  background: rgba(255, 82, 82, 0.25);
}

.net-worth-main .change .period {
  opacity: 0.8;
  font-size: 0.85rem;
}

.net-worth-breakdown {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.breakdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.breakdown-item i {
  font-size: 1.5rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
}

.breakdown-item.assets i {
  color: #00c853;
}

.breakdown-item.liabilities i {
  color: #ff5252;
}

.breakdown-label {
  display: block;
  font-size: 0.85rem;
  opacity: 0.85;
}

.breakdown-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
}

.period-changes {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.period-change {
  text-align: center;
}

.period-label {
  display: block;
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.period-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.period-change.positive .period-value {
  color: #69f0ae;
}

.period-change.negative .period-value {
  color: #ff8a80;
}

/* ============================================
   Accounts Grid
   ============================================ */

.accounts-grid {
  margin-bottom: 2rem;
}

.account-group {
  margin-bottom: 2rem;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary, #b0b0b0);
  margin-bottom: 1rem;
}

.group-title i {
  color: var(--primary-color, #667eea);
}

.group-total {
  margin-left: auto;
  font-size: 1rem;
  color: var(--text-primary, #ffffff);
}

.account-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.account-card {
  background: var(--card-bg, #1e1e2e);
  border-radius: 12px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color, #2d2d3d);
}

.account-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  border-color: var(--primary-color, #667eea);
}

.account-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-left: 0.5rem;
}

.account-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
}

.account-info {
  flex: 1;
}

.account-name {
  display: block;
  font-weight: 600;
  color: var(--text-primary, #ffffff);
  font-size: 1.05rem;
}

.account-institution {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary, #888);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary, #888);
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--hover-bg, #2d2d3d);
  color: var(--text-primary, #ffffff);
}

.account-balance {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.account-balance.positive {
  color: #00c853;
}

.account-balance.negative {
  color: #ff5252;
}

.credit-info {
  margin-bottom: 0.75rem;
}

.credit-bar {
  height: 6px;
  background: var(--border-color, #2d2d3d);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.credit-used {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.credit-text {
  font-size: 0.85rem;
  color: var(--text-secondary, #888);
}

.account-footer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color, #2d2d3d);
}

.last-updated {
  font-size: 0.8rem;
  color: var(--text-secondary, #666);
}

/* ============================================
   Quick Actions
   ============================================ */

.quick-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: var(--card-bg, #1e1e2e);
  border: 1px solid var(--border-color, #2d2d3d);
  border-radius: 12px;
  color: var(--text-primary, #ffffff);
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 100px;
}

.action-btn i {
  font-size: 1.5rem;
  color: var(--primary-color, #667eea);
}

.action-btn:hover {
  background: var(--hover-bg, #2d2d3d);
  border-color: var(--primary-color, #667eea);
  transform: translateY(-2px);
}

/* ============================================
   Chart Section
   ============================================ */

.charts-section {
  margin-bottom: 2rem;
}

.chart-container {
  background: var(--card-bg, #1e1e2e);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--border-color, #2d2d3d);
}

.chart-container h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary, #ffffff);
}

.chart-container h3 i {
  color: var(--primary-color, #667eea);
}

.chart-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chart-period {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color, #2d2d3d);
  background: transparent;
  color: var(--text-secondary, #888);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.chart-period:hover {
  background: var(--hover-bg, #2d2d3d);
  color: var(--text-primary, #ffffff);
}

.chart-period.active {
  background: var(--primary-color, #667eea);
  border-color: var(--primary-color, #667eea);
  color: white;
}

#networth-chart {
  height: 300px;
}

/* ============================================
   Modal Styles
   ============================================ */

.account-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--card-bg, #1e1e2e);
  border-radius: 16px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color, #2d2d3d);
  animation: modalSlideIn 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary, #888);
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-primary, #ffffff);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color, #2d2d3d);
}

.modal-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary, #ffffff);
  font-size: 1.25rem;
}

.modal-header h3 i {
  color: var(--primary-color, #667eea);
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, #2d2d3d);
}

/* ============================================
   Form Styles
   ============================================ */

.account-form,
.transfer-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.form-group input,
.form-group select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color, #2d2d3d);
  border-radius: 8px;
  background: var(--input-bg, #252535);
  color: var(--text-primary, #ffffff);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color, #667eea);
}

.form-group input[type="color"] {
  height: 42px;
  padding: 0.25rem;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.transfer-arrow {
  display: flex;
  justify-content: center;
  color: var(--primary-color, #667eea);
  font-size: 1.5rem;
  padding: 0.5rem;
}

/* ============================================
   Buttons
   ============================================ */

.btn-primary {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--text-primary, #ffffff);
  border: 1px solid var(--border-color, #2d2d3d);
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--hover-bg, #2d2d3d);
  border-color: var(--primary-color, #667eea);
}

.btn-danger {
  padding: 0.75rem 1.5rem;
  background: #ff5252;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: #ff1744;
  box-shadow: 0 5px 20px rgba(255, 82, 82, 0.4);
}

/* ============================================
   Account Details Modal
   ============================================ */

.account-details-content {
  padding: 1rem 0;
}

.balance-display {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: var(--input-bg, #252535);
  border-radius: 12px;
}

.balance-display .label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary, #888);
  margin-bottom: 0.5rem;
}

.balance-display .balance-amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
}

.details-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.details-actions .btn-secondary {
  flex: 1;
}

.account-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.meta-item {
  padding: 1rem;
  background: var(--input-bg, #252535);
  border-radius: 8px;
}

.meta-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary, #888);
  margin-bottom: 0.25rem;
}

.meta-value {
  font-weight: 600;
  color: var(--text-primary, #ffffff);
}

.account-type-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--primary-color, #667eea);
  color: white;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ============================================
   History List
   ============================================ */

.history-list {
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color, #2d2d3d);
}

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

.history-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--input-bg, #252535);
}

.history-item.positive .history-icon {
  color: #00c853;
}

.history-item.negative .history-icon {
  color: #ff5252;
}

.history-info {
  flex: 1;
}

.history-description {
  display: block;
  font-weight: 500;
  color: var(--text-primary, #ffffff);
}

.history-date {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary, #888);
}

.history-amount {
  font-weight: 600;
  font-size: 1.1rem;
}

.history-item.positive .history-amount {
  color: #00c853;
}

.history-item.negative .history-amount {
  color: #ff5252;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary, #888);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

/* ============================================
   Loading States
   ============================================ */

.loading-spinner {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary, #888);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
  .accounts-dashboard {
    padding: 1rem;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .dashboard-header h2 {
    font-size: 1.5rem;
  }

  .net-worth-card {
    padding: 1.5rem;
  }

  .net-worth-main .amount {
    font-size: 2rem;
  }

  .net-worth-breakdown {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .breakdown-value {
    font-size: 1.25rem;
  }

  .period-changes {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .account-cards {
    grid-template-columns: 1fr;
  }

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

  .account-meta {
    grid-template-columns: 1fr;
  }

  .details-actions {
    flex-direction: column;
  }

  .quick-actions {
    justify-content: center;
  }

  .modal-content {
    padding: 1.5rem;
    margin: 0.5rem;
  }

  #networth-chart {
    height: 200px;
  }
}

/* ============================================
   Notification Animation
   ============================================ */

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

/* ============================================
   Dark/Light Theme Variables
   ============================================ */

:root {
  --primary-color: #667eea;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --card-bg: #1e1e2e;
  --input-bg: #252535;
  --border-color: #2d2d3d;
  --hover-bg: #2d2d3d;
}

[data-theme="light"] {
  --text-primary: #1a1a2e;
  --text-secondary: #666666;
  --card-bg: #ffffff;
  --input-bg: #f5f5f5;
  --border-color: #e0e0e0;
  --hover-bg: #f0f0f0;
}
