/* Custom premium styling for Yangjian Dashboard */
:root {
  --bg-color: #0b0f19;
  --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #111827 100%);
  --card-bg: rgba(17, 24, 39, 0.7);
  --card-border: rgba(255, 255, 255, 0.06);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.15);
  
  --positive: #ef4444;
  --positive-glow: rgba(239, 68, 68, 0.15);
  --positive-text-glow: 0 0 10px rgba(239, 68, 68, 0.4);
  
  --negative: #10b981;
  --negative-glow: rgba(16, 185, 129, 0.15);
  --negative-text-glow: 0 0 10px rgba(16, 185, 129, 0.4);
  
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.dashboard-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Glassmorphism Common Styles */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: var(--transition);
}

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

/* Header Area */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1.5rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 10px var(--primary));
}

.logo-text h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.1rem;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Segment Control */
.segment-control {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.segment-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 20px;
  font-family: var(--font-family);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 25px;
  cursor: pointer;
  transition: var(--transition);
}

.segment-btn:hover {
  color: var(--text-main);
}

.segment-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

/* Main Content Layout */
.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Control Panel */
.control-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.2rem 1.5rem;
}

.selector-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.selector-container label {
  color: var(--text-muted);
  font-weight: 500;
}

.custom-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.custom-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.custom-select option {
  background: #111827;
  color: var(--text-main);
}

.date-badge {
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.5rem;
}

.card-icon {
  font-size: 2.2rem;
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-info {
  flex: 1;
}

.card-info h3 {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.card-info .value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02rem;
}

.card-info .value.positive {
  color: var(--positive);
  text-shadow: var(--positive-text-glow);
}

.card-info .value.negative {
  color: var(--negative);
  text-shadow: var(--negative-text-glow);
}

.double-value {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.double-value .separator {
  color: var(--text-muted);
}

/* Chart Styles */
.chart-section {
  padding: 1.8rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--primary);
  padding-left: 0.8rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.glow-indicator {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08rem;
  color: var(--positive);
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.chart-container {
  position: relative;
  width: 100%;
  height: 350px;
}

/* Details Section Table */
.details-section {
  padding: 1.8rem;
}

.table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.details-table th,
.details-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.details-table th {
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05rem;
}

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

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

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

.table-pnl {
  font-weight: 600;
}

.table-pnl.positive {
  color: var(--positive);
}

.table-pnl.negative {
  color: var(--negative);
}

/* Status Badges */
.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-pill.profit {
  background: var(--positive-glow);
  color: var(--positive);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-pill.loss {
  background: var(--negative-glow);
  color: var(--negative);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Footer Section */
.main-footer {
  text-align: center;
  padding: 1.5rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Responsive Rules */
@media(max-width: 768px) {
  .main-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .segment-control {
    width: 100%;
    justify-content: space-around;
  }
  .control-panel {
    flex-direction: column;
    align-items: stretch;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* Extra Mobile Spacing Optimizations */
@media(max-width: 640px) {
  .details-table th,
  .details-table td {
    padding: 8px 8px !important;
    font-size: 0.75rem !important;
  }
  .glass-card {
    padding: 1rem !important;
  }
  .logo-icon {
    font-size: 2rem !important;
  }
}
