/* 
  Jorge's Portfolio Dashboard Design System
  Style: Modern Dark Glassmorphism
*/

:root {
  /* Colors */
  --bg-primary: #0b0f19;
  --bg-secondary: rgba(17, 24, 39, 0.65);
  --bg-glass-card: rgba(22, 28, 45, 0.45);
  --border-glass: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(99, 102, 241, 0.4);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --primary-accent: #6366f1; /* Indigo */
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  
  --success: #10b981; /* Emerald */
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.2);
  
  --danger: #ef4444; /* Red */
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.2);

  --warning: #f59e0b; /* Amber */
  --warning-bg: rgba(245, 158, 11, 0.1);
  
  /* Fonts */
  --font-header: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Radii & Shadows */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-lg: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Ambient Background Decor */
.background-decor {
  position: fixed;
  top: -10%;
  left: -10%;
  width: 120vw;
  height: 120vh;
  background: 
    radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(124, 58, 237, 0.08) 0%, transparent 45%);
  pointer-events: none;
  z-index: -1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-height: 100vh;
}

/* Glassmorphic Card Mixin replacement */
.card {
  background: var(--bg-glass-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transition: var(--transition-smooth);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

/* Header Styles */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  background: var(--primary-gradient);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-glow);
}

.brand-text h1 {
  font-family: var(--font-header);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-text .subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid var(--border-glass);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--warning);
  display: inline-block;
  animation: pulse 2s infinite;
}

.status-badge.connected .pulse-dot {
  background-color: var(--success);
}

.status-badge.disconnected .pulse-dot {
  background-color: var(--danger);
  animation: none;
}

.btn-refresh {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-refresh:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-accent);
  transform: rotate(30deg);
}

.btn-refresh.spinning i {
  animation: spin 1s linear infinite;
}

/* Loading & States */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  gap: 20px;
  color: var(--text-secondary);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  border-top-color: var(--primary-accent);
  animation: spin 1s ease-in-out infinite;
}

.error-card {
  padding: 40px;
  text-align: center;
  max-width: 500px;
  margin: 40px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.error-icon {
  font-size: 40px;
  color: var(--danger);
}

.btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.3);
}

.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Metrics Dashboard Content */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.metric-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metric-card.highlight {
  border-left: 3px solid var(--primary-accent);
}

.metric-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.metric-card .icon {
  font-size: 18px;
  color: var(--primary-accent);
  opacity: 0.8;
}

.metric-value {
  font-family: var(--font-header);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.metric-change {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.metric-change.up {
  color: var(--success);
}

.metric-change.down {
  color: var(--danger);
}

.change-label {
  color: var(--text-muted);
  font-weight: 400;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Holdings & Charts Section */
.holdings-card,
.chart-card {
  padding: 32px;
}

.holdings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.holdings-header h2 {
  font-family: var(--font-header);
  font-size: 20px;
  font-weight: 700;
}

.badge {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-accent);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.holdings-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.holdings-table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.holdings-table td {
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 14px;
}

.holdings-table tbody tr {
  transition: var(--transition-smooth);
}

.holdings-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

.holdings-table tfoot tr {
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.025);
  font-weight: 700;
}

.holdings-table tfoot td {
  padding: 16px;
  font-family: var(--font-header);
  font-size: 15px;
  border-bottom: none;
}

.asset-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.symbol {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 15px;
}

.company-name {
  font-size: 12px;
  color: var(--text-secondary);
}

.text-right {
  text-align: right;
}

.txt-success {
  color: var(--success);
  font-weight: 600;
}

.txt-danger {
  color: var(--danger);
  font-weight: 600;
}

.no-holdings-message {
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

/* Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-glass);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.app-footer code {
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
}

.api-info {
  font-weight: 500;
  color: var(--text-secondary);
}

/* Animations */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

/* Green pulse for active status */
.status-badge.connected .pulse-dot {
  animation: pulse-success 2s infinite;
}

@keyframes pulse-success {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

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

/* Responsive Grid adaptations */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .holdings-card {
    padding: 20px;
  }
  
  .holdings-table th, .holdings-table td {
    padding: 12px 8px;
    font-size: 13px;
  }
  
  .app-footer {
    flex-direction: column;
    gap: 12px;
    align-items: center;
    text-align: center;
  }
}
