/**
 * Dashboard Visual Enhancements
 * Premium visual optimizations for the entire DXFI dashboard
 * Focus: Better spacing, typography, shadows, animations, and overall polish
 */

/* ===== Enhanced Card Styling ===== */
.dashboard-card {
  /* Improved shadows for depth */
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 4px 16px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);

  /* Smoother transitions */
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s ease;

  /* Better border */
  border: 1px solid rgba(255, 255, 255, 0.12);

  /* Subtle hover lift */
  will-change: transform;
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

/* ===== Enhanced Stat Cards ===== */
.stat-card {
  /* Better visual hierarchy */
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
      transparent 0%,
      var(--color-primary) 50%,
      transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover::after {
  opacity: 0.6;
}

.stat-value-compact {
  /* Better number rendering */
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  letter-spacing: -0.02em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Enhanced Typography ===== */
.dashboard-title {
  /* Better text rendering */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1;
}

/* ===== Improved Input Fields ===== */
.swap-amount-input,
input[type="number"],
input[type="text"] {
  /* Better text rendering */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';

  /* Smooth transitions */
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

/* ===== Enhanced Buttons ===== */
.btn,
.swap-execute-btn,
.swap-percentage-btn {
  /* Better button rendering */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Smoother transitions */
  transition:
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.2s ease,
    border-color 0.2s ease;

  /* Prevent layout shift */
  will-change: transform;
}

.btn:active,
.swap-execute-btn:active,
.swap-percentage-btn:active {
  transform: scale(0.98);
}

/* ===== Better Loading States ===== */
.swap-status.loading {
  /* Animated loading indicator */
  position: relative;
  overflow: hidden;
}

.swap-status.loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.1) 50%,
      transparent 100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }

  100% {
    left: 100%;
  }
}

/* ===== Enhanced Focus States ===== */
.swap-amount-input:focus,
input:focus {
  outline: 2px solid var(--color-primary, #1FDDFE);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(31, 221, 254, 0.15);
}

/* Ensure keyboard navigation has visible focus - subtle but accessible */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--color-primary, #1FDDFE);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(31, 221, 254, 0.15);
}

/* ===== Better Spacing Consistency ===== */
.dashboard-content {
  /* Improved spacing rhythm */
  gap: var(--spacing-lg);
}

.dashboard-row {
  /* Better grid spacing */
  gap: var(--spacing-md);
}

/* ===== Enhanced Card Headers ===== */
.card-header {
  /* Better header separation */
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.card-title {
  /* Better title typography */
  font-weight: 700;
  letter-spacing: -0.01em;
  text-rendering: optimizeLegibility;
}

/* ===== Improved Table Styling ===== */
.positions-table,
table {
  /* Better table rendering */
  border-collapse: separate;
  border-spacing: 0;
}

.positions-table th,
table th {
  /* Better header styling */
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.positions-table td,
table td {
  /* Better cell padding */
  padding: var(--spacing-sm) var(--spacing-md);
}

/* ===== Enhanced Scrollbars ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== Better Mobile Touch Targets ===== */
@media (max-width: 768px) {

  .btn,
  .swap-execute-btn,
  .swap-percentage-btn,
  button {
    /* Larger touch targets on mobile */
    min-height: 44px;
    min-width: 44px;
  }

  /* Better mobile spacing */
  .dashboard-content {
    gap: var(--spacing-md);
    padding: 0 var(--spacing-sm);
  }

  .dashboard-card {
    /* Slightly reduced padding on mobile */
    padding: var(--spacing-md);
  }
}

/* ===== Enhanced Color Contrast ===== */
.stat-label-compact,
.swap-section-label,
.card-title {
  /* Better contrast for readability */
  color: var(--text-secondary);
  opacity: 0.9;
}

/* ===== Smooth Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-card,
.stat-card {
  animation: fadeIn 0.4s ease-out;
}

/* ===== Better Visual Hierarchy ===== */
.stat-value-compact {
  /* More prominent values */
  font-weight: 700;
  line-height: 1.2;
}

.stat-label-compact {
  /* Subtle labels */
  font-weight: 500;
  opacity: 0.7;
  font-size: 0.875rem;
}

/* ===== Enhanced Swap Card Specific ===== */
.swap-card {
  /* Better swap card depth */
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.swap-amount-container {
  /* Better input container */
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.swap-amount-container:focus-within {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(31, 221, 254, 0.5);
  box-shadow:
    0 0 0 3px rgba(31, 221, 254, 0.1),
    0 2px 8px rgba(31, 221, 254, 0.15);
}

/* ===== Better Button States ===== */
.swap-execute-btn:not(:disabled) {
  /* Enhanced button gradient */
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow:
    0 4px 12px rgba(16, 185, 129, 0.3),
    0 2px 4px rgba(16, 185, 129, 0.2);
}

.swap-execute-btn:not(:disabled):hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow:
    0 6px 16px rgba(16, 185, 129, 0.4),
    0 4px 8px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

/* ===== Improved Chart Container ===== */
.growth-chart-body {
  /* Better chart rendering */
  position: relative;
  overflow: hidden;
}

.growth-chart-body canvas {
  /* Better canvas rendering */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ===== Enhanced Dropdowns ===== */
.custom-dropdown select {
  /* Better dropdown styling */
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
  transition: all 0.2s ease;
}

.custom-dropdown select:focus {
  border-color: rgba(31, 221, 254, 0.4);
  box-shadow: 0 0 0 3px rgba(31, 221, 254, 0.1);
}

/* ===== Better Status Indicators ===== */
.swap-status {
  /* Better status message styling */
  border-radius: var(--radius-lg);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ===== Enhanced Light Mode ===== */
html.light .dashboard-card {
  /* Better light mode contrast */
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    0 4px 16px rgba(0, 0, 0, 0.04);
}

html.light .dashboard-card:hover {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.15);
}

html.light .swap-amount-container {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

html.light .swap-amount-container:focus-within {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(14, 165, 233, 0.4);
  box-shadow:
    0 0 0 3px rgba(14, 165, 233, 0.1),
    0 2px 8px rgba(14, 165, 233, 0.15);
}

/* ===== Performance Optimizations ===== */
.dashboard-card,
.stat-card,
.swap-card {
  /* GPU acceleration for smooth animations */
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ===== Better Empty States ===== */
.empty-state,
.no-data {
  /* Better empty state styling */
  padding: var(--spacing-xl);
  text-align: center;
  color: var(--text-tertiary);
  opacity: 0.7;
}

/* ===== Enhanced Tooltips ===== */
/* Removed CSS tooltip - using native browser tooltips (title attribute) */

/* ===== Better Form Validation ===== */
input:invalid {
  border-color: var(--color-danger);
}

input:valid {
  border-color: var(--color-success);
}

/* ===== Enhanced Responsive Typography ===== */
@media (max-width: 768px) {
  .stat-value-compact {
    font-size: clamp(1.5rem, 4vw, 2rem);
  }

  .dashboard-title {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
  }
}

/* ===== Better Visual Feedback ===== */
.btn:disabled,
.swap-execute-btn:disabled {
  /* Better disabled state */
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

/* ===== Enhanced Loading Spinners ===== */
.loading-spinner {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Better Print Styles ===== */
@media print {
  .dashboard-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
