/* e:\Antigravity\workspace\Cineaho\quant-simulator\styles.css */

/* Core Design System Tokens */
:root {
  --bg-color: #060913;
  --bg-grid: rgba(255, 255, 255, 0.015);
  
  --panel-bg: rgba(14, 20, 38, 0.65);
  --panel-border: rgba(255, 255, 255, 0.05);
  --panel-hover-border: rgba(0, 242, 254, 0.25);
  
  --color-primary: #a855f7; /* Purple */
  --color-secondary: #00f2fe; /* Cyan */
  --color-success: #10b981; /* Green */
  --color-danger: #ef4444; /* Red */
  --color-warning: #fbbf24; /* Gold */
  
  --text-main: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-main: 'Noto Sans KR', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
  --glass-border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Global Reset & Body */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Grid background pattern */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -2;
  pointer-events: none;
}

/* App Header */
.main-header {
  height: 70px;
  background: rgba(9, 13, 26, 0.8);
  border-bottom: var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: var(--glass-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: var(--transition-smooth);
}

.back-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: translateX(-3px);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  background: linear-gradient(135deg, #a855f7 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-logo i {
  -webkit-text-fill-color: initial;
  color: #a855f7;
  font-size: 22px;
}

.header-right {
  display: flex;
  align-items: center;
}

.app-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-success);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

/* Main Container Layout */
.app-container {
  display: grid;
  grid-template-columns: 340px 380px 1fr;
  gap: 20px;
  padding: 24px;
  max-width: 1800px;
  margin: 0 auto;
  height: calc(100vh - 70px);
}

@media (max-width: 1400px) {
  .app-container {
    grid-template-columns: 320px 1fr;
    grid-template-rows: auto auto;
    height: auto;
  }
  .results-panel {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  .strategy-panel, .config-panel, .results-panel {
    grid-column: span 1;
  }
}

/* Panels (Glassmorphism) */
.glass-panel {
  background: var(--panel-bg);
  border: var(--glass-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  overflow-y: auto;
}

.glass-panel::-webkit-scrollbar {
  width: 6px;
}
.glass-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
.glass-panel h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.glass-panel h2 i {
  color: var(--color-secondary);
}

.panel-intro {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

/* Strategy Presets styling */
.presets-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preset-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
}

.preset-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.preset-card.active {
  background: rgba(168, 85, 247, 0.08);
  border-color: var(--color-primary);
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.15);
}

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

.preset-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
}

.preset-header h3 i {
  color: var(--color-warning);
}

.preset-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.2);
  color: var(--color-secondary);
  font-weight: 700;
}

.preset-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.preset-formula {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 10px;
  color: var(--color-warning);
  font-family: var(--font-display);
  font-weight: 500;
  margin-bottom: 10px;
}

.btn-preset-apply {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  width: 100%;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-preset-apply:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.preset-card.active .btn-preset-apply {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Config Form Elements */
.form-section {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
}

.form-section h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-secondary);
}

.form-section h3 i {
  font-size: 14px;
}

.section-intro {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: -6px;
  margin-bottom: 12px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-group input[type="number"],
.form-group select {
  background: rgba(9, 13, 26, 0.6);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-main);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-group input[type="number"]:focus,
.form-group select:focus {
  border-color: var(--color-secondary);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
}

/* Custom Sliders for weights */
.slider-control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slider-row {
  display: flex;
  flex-direction: column;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.slider-label-row span:last-child {
  color: var(--color-warning);
  font-weight: 700;
}

.factor-weight-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: var(--transition-smooth);
}

.factor-weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-warning);
  cursor: pointer;
  border: 2px solid #060913;
  transition: var(--transition-smooth);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

.factor-weight-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #fff;
}

/* Execute Button */
.btn-execute {
  background: linear-gradient(135deg, #a855f7 0%, #00f2fe 100%);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 8px;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.25);
}

.btn-execute:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(0, 242, 254, 0.4);
}

.btn-execute:active {
  transform: translateY(0);
}

/* Placeholder and spinner */
.placeholder-box, .spinner-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  text-align: center;
}

.placeholder-box i {
  font-size: 60px;
  color: var(--text-muted);
  margin-bottom: 15px;
  opacity: 0.3;
}

.placeholder-box p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.spinner-box i {
  font-size: 40px;
  color: var(--color-secondary);
  margin-bottom: 15px;
}

.spinner-box p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Results Content */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-card {
  background: rgba(255, 255, 255, 0.02);
  border: var(--glass-border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: var(--transition-smooth);
}

.kpi-card:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.kpi-card h4 {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.kpi-card p {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
}

.kpi-card p.positive {
  color: var(--color-success);
}

.kpi-card p.negative {
  color: var(--color-danger);
}

/* Charts containers */
.chart-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1000px) {
  .chart-container {
    grid-template-columns: 1fr;
  }
}

.chart-box {
  background: rgba(0, 0, 0, 0.2);
  border: var(--glass-border);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

.chart-box h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-box h4 i {
  color: var(--color-secondary);
}

.chart-box canvas {
  width: 100% !important;
  height: 250px !important;
}

/* Detailed Tables */
.details-section {
  margin-bottom: 20px;
}

.details-section h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.details-section h3 i {
  color: var(--color-primary);
}

.table-wrapper {
  background: rgba(0, 0, 0, 0.25);
  border: var(--glass-border);
  border-radius: 8px;
  overflow: auto;
}

.table-height-limit {
  max-height: 250px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 11px;
}

thead {
  background: rgba(255, 255, 255, 0.03);
  position: sticky;
  top: 0;
  z-index: 10;
}

thead th {
  padding: 8px 12px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: var(--transition-smooth);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody td {
  padding: 8px 12px;
  color: var(--text-main);
}

tbody td.positive {
  color: var(--color-success);
  font-weight: 700;
}

tbody td.negative {
  color: var(--color-danger);
  font-weight: 700;
}
