@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700;800&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: rgba(22, 31, 52, 0.75);
  --bg-table-header: #1a253e;
  --bg-table-hover: rgba(59, 130, 246, 0.15);
  
  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(99, 102, 241, 0.4);

  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-highlight: #60a5fa;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  
  --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.2);
}

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

/* 🚫 숫자 입력창 위아래 스핀 화살표 숨김 처리 */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
}

body {
  font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  background: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(6, 182, 212, 0.12) 0%, transparent 45%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  padding-bottom: 60px;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Header Actions & Preset Selector */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.preset-select-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-md);
}

.preset-select-wrapper label {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

select.custom-select {
  background: transparent;
  color: var(--text-main);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #2563eb);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: #1c2744;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-purple), #7c3aed);
  color: #fff;
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.5);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

/* Card Section */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

.card-title span.badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  border-radius: 20px;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

/* Param Grid */
.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.param-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.param-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.param-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.param-input-wrapper input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

.param-input-wrapper input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.param-input-wrapper select.custom-select-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.param-input-wrapper select.custom-select-input option {
  background: var(--bg-secondary);
  color: var(--text-main);
}

.param-input-wrapper select.custom-select-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Excel Style Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-top: 12px;
}

table.excel-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.9rem;
}

table.excel-table th {
  background: var(--bg-table-header);
  color: #d1d5db;
  font-weight: 700;
  padding: 12px 10px;
  border-bottom: 2px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  white-space: nowrap;
}

table.excel-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  background: rgba(19, 27, 46, 0.4);
  transition: background 0.15s;
}

table.excel-table tr:hover td {
  background: var(--bg-table-hover);
}

table.excel-table input.td-input {
  width: 75px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #fff;
  text-align: center;
  padding: 6px 4px;
  font-weight: 600;
  outline: none;
}

table.excel-table input.td-input:focus {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.2);
}

.num-cell {
  font-weight: 700;
  font-family: 'Inter', sans-serif;
}

/* 🌟 소수점 이중 색상 구분 (정수부 / 소수부) 스타일 */
.num-int {
  font-weight: 700;
  font-family: 'Inter', sans-serif;
}

.num-dec {
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  opacity: 0.85;
  font-size: 0.88em;
  padding: 1px 4px;
  margin-left: 2px;
  border-radius: 4px;
  display: inline-block;
}

/* 컬럼별 정수부/소수부 이중 테마 색상 */
td.col-cost .num-int { color: #60a5fa; }
td.col-cost .num-dec { color: #93c5fd; background: rgba(96, 165, 250, 0.15); border: 1px solid rgba(96, 165, 250, 0.3); }

td.col-tax .num-int { color: #34d399; }
td.col-tax .num-dec { color: #a7f3d0; background: rgba(52, 211, 153, 0.15); border: 1px solid rgba(52, 211, 153, 0.3); }

td.col-attempts .num-int { color: #fbbf24; }
td.col-attempts .num-dec { color: #fde68a; background: rgba(251, 191, 36, 0.15); border: 1px solid rgba(251, 191, 36, 0.3); }

td.col-rel-attempts .num-int { color: #38bdf8; }
td.col-rel-attempts .num-dec { color: #bae6fd; background: rgba(56, 189, 248, 0.15); border: 1px solid rgba(56, 189, 248, 0.3); }

.cost-highlight {
  color: #60a5fa;
  font-weight: 700;
}

.blessed-cost {
  color: var(--accent-amber);
  font-weight: 700;
}

.blessed-result {
  color: var(--accent-green);
  font-weight: 700;
}

.badge-recommend {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Controls Bar above table */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

/* Simulation Modal & Section */
.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.sim-stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
}

.sim-stat-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sim-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  width: 90%;
  max-width: 650px;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

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

.modal-header h3 {
  font-size: 1.3rem;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

textarea.json-textarea {
  width: 100%;
  height: 250px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #38edf8;
  font-family: monospace;
  font-size: 0.85rem;
  padding: 12px;
  outline: none;
  resize: vertical;
}

.drag-area {
  border: 2px dashed var(--accent-blue);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 14px;
  cursor: pointer;
  background: rgba(59, 130, 246, 0.05);
}

.drag-area:hover {
  background: rgba(59, 130, 246, 0.1);
}
