/* Calm & Modern Dark Theme for SDVX Volforce Calculator */
:root {
  --bg-dark: #0f172a;       /* Slate 900 */
  --bg-card: #1e293b;       /* Slate 800 */
  --bg-card-hover: #334155; /* Slate 700 */
  --bg-input: #0f172a;
  
  --border-color: #334155;
  --border-focus: #6366f1;   /* Indigo 500 */

  --text-main: #f8fafc;
  --text-sub: #94a3b8;
  --text-dim: #64748b;

  --accent-primary: #6366f1; /* Calm Indigo */
  --accent-success: #10b981; /* Emerald Green */
  --accent-amber: #f59e0b;   /* Amber */
  --accent-blue: #3b82f6;    /* Blue */

  --font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Rajdhani', monospace;

  /* Tier Colors (Calm Muted Tones) */
  --tier-sienna: #8d5524;
  --tier-cobalt: #2563eb;
  --tier-dandelion: #d97706;
  --tier-cyan: #0891b2;
  --tier-scarlet: #dc2626;
  --tier-coral: #e11d48;
  --tier-argento: #64748b;
  --tier-eldora: #d97706;
  --tier-crimson: #b91c1c;
  --tier-imperial: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
}

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

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.5;
}

/* App Layout Container */
.app-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.accent-text {
  color: var(--accent-primary);
}

.app-subtitle {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
}

.header-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-width: 0;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.control-group label {
  font-size: 11px;
  color: var(--text-sub);
  font-weight: 500;
}

.cyber-select {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  height: 38px;
  line-height: 36px;
  max-width: 100%;
}

.cyber-select:focus, .cyber-select:hover {
  border-color: var(--accent-primary);
}

.cyber-btn {
  background: #334155;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  height: 38px;
}

.cyber-btn:hover {
  background: #475569;
  color: #fff;
}

.cyber-btn.primary-btn {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.cyber-btn.primary-btn:hover {
  background: #4f46e5;
}

.full-width {
  width: 100%;
  justify-content: center;
}

/* Main Layout Grid */
.main-content {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 24px;
  width: 100%;
  max-width: 100%;
}

/* Responsive Breakpoints for Header & Layout */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 16px 12px;
    gap: 16px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px 16px;
  }

  .brand {
    align-items: center;
    gap: 10px;
  }

  .logo-icon {
    width: 38px;
    height: 38px;
    font-size: 15px;
    border-radius: 8px;
  }

  .app-title {
    font-size: 17px;
  }

  .app-subtitle {
    font-size: 11px;
  }

  .header-controls {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
  }

  .control-group {
    flex: 1;
    min-width: 0;
  }

  .cyber-select {
    width: 100%;
    font-size: 12px;
    padding: 0 8px;
    height: 38px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }

  .cyber-btn#langToggleBtn {
    height: 38px;
    padding: 0 12px;
    font-size: 12px;
    flex-shrink: 0;
  }
}

/* Panel Styles */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

@media (max-width: 640px) {
  .panel {
    padding: 16px;
  }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-header h2 {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-badge {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.sub-header-text {
  font-size: 12px;
  color: var(--text-sub);
}

/* Form Controls */
.vf-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.label-row label {
  font-weight: 600;
  font-size: 14px;
}

.input-hint {
  font-size: 11px;
  color: var(--text-dim);
}

.cyber-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  outline: none;
  transition: border-color 0.15s;
}

.cyber-input:focus {
  border-color: var(--border-focus);
}

/* Quick Chips */
.quick-level-presets, .quick-score-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  width: 100%;
}

.preset-chip, .score-chip {
  background: #0f172a;
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-chip:hover, .score-chip:hover {
  background: #334155;
  color: #fff;
}

.preset-chip.highlight, .score-chip.highlight {
  border-color: var(--accent-primary);
  color: #818cf8;
}

.score-input-wrapper {
  position: relative;
  width: 100%;
}

.score-formatted {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-sub);
  pointer-events: none;
  font-weight: 600;
}

/* Clear Mark Grid */
.clear-mark-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

@media (max-width: 480px) {
  .clear-mark-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.clear-card {
  position: relative;
  cursor: pointer;
  min-width: 0;
}

.clear-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.clear-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.15s;
  text-align: center;
}

.clear-card:hover .clear-content {
  border-color: #475569;
}

.clear-card input[type="radio"]:checked + .clear-content {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
}

.mark-title {
  font-size: 12px;
  font-weight: 700;
}

.p-puc .mark-title { color: #f59e0b; }
.p-uc .mark-title { color: #ec4899; }
.p-mxv .mark-title, .p-mx .mark-title { color: #8b5cf6; }
.p-ex .mark-title { color: #3b82f6; }
.p-ef .mark-title { color: #10b981; }
.p-play .mark-title { color: #64748b; }

.mark-sub {
  font-size: 10px;
  color: var(--text-dim);
}

.mark-mult {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
}

/* Result Dashboard */
.result-dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.vf-primary-card {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px;
  width: 100%;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 600;
}

.vf-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 10px 0 4px;
}

.force-num {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 800;
  color: #fff;
}

.force-unit {
  font-size: 16px;
  color: var(--accent-primary);
  font-weight: 700;
}

.vf-contribution {
  font-size: 13px;
  color: var(--text-sub);
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  margin-top: 4px;
}

.contribution-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #818cf8;
}

/* Rank Badges */
.rank-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
}

.rank-s { background: #d97706; color: #fff; }
.rank-aaa-p { background: #db2777; color: #fff; }
.rank-aaa { background: #7c3aed; color: #fff; }
.rank-aa-p { background: #2563eb; color: #fff; }
.rank-aa { background: #0d9488; color: #fff; }
.rank-a-p { background: #059669; color: #fff; }
.rank-a { background: #78350f; color: #fff; }
.rank-b { background: #475569; color: #fff; }
.rank-c, .rank-d { background: #334155; color: #94a3b8; }

/* Tier Badges */
.tier-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  color: #fff;
}

.tier-sienna { background: var(--tier-sienna); }
.tier-cobalt { background: var(--tier-cobalt); }
.tier-dandelion { background: var(--tier-dandelion); }
.tier-cyan { background: var(--tier-cyan); }
.tier-scarlet { background: var(--tier-scarlet); }
.tier-coral { background: var(--tier-coral); }
.tier-argento { background: var(--tier-argento); }
.tier-eldora { background: var(--tier-eldora); }
.tier-crimson { background: var(--tier-crimson); }
.tier-imperial { background: var(--tier-imperial); }

/* Breakdown Metrics */
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}

.metric-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metric-label {
  font-size: 11px;
  color: var(--text-dim);
}

.metric-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right Column Panels */
.right-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  min-width: 0;
}

/* Interactive Score Simulator Styles */
.simulator-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  width: 100%;
}

.sim-slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.sim-range-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  background: #1e293b;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.sim-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
  cursor: pointer;
  transition: transform 0.1s;
}

.sim-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.sim-preview-card {
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.sim-card-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.sim-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}

@media (max-width: 480px) {
  .sim-grid {
    grid-template-columns: 1fr;
  }
}

.sim-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  min-width: 0;
}

.sim-label {
  color: var(--text-sub);
}

.sim-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
}

.sim-val.delta-pos {
  color: #10b981;
}

.sim-val.highlight {
  color: #818cf8;
}

.sim-val.gain-pos {
  color: #f59e0b;
}

/* Recommendation Cards */
.recommendation-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.rec-card {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s;
  width: 100%;
}

.rec-card:hover {
  border-color: #475569;
}

.rec-card.priority-high {
  border-left-color: #3b82f6;
}

.rec-card.priority-max {
  border-left-color: #f59e0b;
}

.rec-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rec-target-title {
  font-size: 14px;
  font-weight: 700;
}

.rec-type-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #1e293b;
  color: var(--text-sub);
}

.rec-details {
  font-size: 12px;
  color: var(--text-sub);
}

.rec-gain-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293b;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 2px;
}

.rec-gain-force {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
  font-size: 13px;
}

.rec-gain-vf {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #818cf8;
  font-weight: 600;
}

/* Top 50 Manager */
.header-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top50-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.action-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.action-btn:hover {
  background: #334155;
  color: #fff;
}

.action-btn.danger:hover {
  background: rgba(220, 38, 38, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

/* Total VF Banner */
.total-vf-banner {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.total-vf-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.total-vf-info .label {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 600;
}

.total-vf-score {
  display: flex;
  align-items: center;
  gap: 10px;
}

#totalVfValue {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 800;
  color: #818cf8;
}

.total-count-text {
  font-size: 12px;
  color: var(--text-dim);
}

/* Tier Progress Bar */
.tier-progress-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-sub);
}

.progress-bar-track {
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
  width: 100%;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}

.needed-text {
  font-size: 11px;
  color: var(--accent-amber);
  text-align: right;
  font-weight: 500;
}

/* Top 50 Table */
.top50-table-container {
  overflow-x: auto;
  max-height: 380px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 100%;
}

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

.top50-table th {
  background: #0f172a;
  padding: 8px 12px;
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

.top50-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-mono);
}

.top50-row {
  cursor: pointer;
  transition: background-color 0.15s;
}

.top50-row:hover {
  background: var(--bg-card-hover) !important;
}

.table-row-num {
  color: var(--text-dim);
}

.delete-row-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.delete-row-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.empty-table-msg {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* Form Highlight Flash */
@keyframes formFlash {
  0% { border-color: var(--accent-primary); box-shadow: 0 0 12px rgba(99, 102, 241, 0.4); }
  100% { border-color: var(--border-color); box-shadow: none; }
}

.form-flash {
  animation: formFlash 0.8s ease-out;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 16px 0;
  font-size: 12px;
  color: var(--text-dim);
  width: 100%;
}
