@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700;900&display=swap');

:root {
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fff5f5;
  --border: #e2e2e2;
  --accent: #cc0000;
  --accent-light: #e60000;
  --accent-dark: #990000;
  --green: #059669;
  --red: #cc0000;
  --blue: #1d4ed8;
  --purple: #7c3aed;
  --text-primary: #111111;
  --text-secondary: #333333;
  --text-muted: #666666;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 20%, rgba(204, 0, 0, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(29, 78, 216, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Header */
.header {
  background: linear-gradient(135deg, #ffffff 0%, #fff0f0 100%);
  border-bottom: 2px solid #cc0000;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  box-shadow: 0 2px 8px rgba(204,0,0,0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  max-width: 1600px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 700;
  color: #cc0000;
}

.logo-text p {
  font-size: 11px;
  color: #555555;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.date-badge {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: #333333;
  font-weight: 500;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* Main Layout */
.main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px 32px;
  position: relative;
  z-index: 1;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 28px;
  width: fit-content;
}

.tab-btn {
  padding: 10px 28px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #444444;
  background: transparent;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #111111;
  background: #ffffff;
}

.tab-btn.active {
  background: linear-gradient(135deg, #cc0000, #990000);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(204, 0, 0, 0.3);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: default;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #cc0000, #ff4444);
  opacity: 0;
  transition: opacity 0.3s;
}

.kpi-card:hover {
  background: #fff5f5;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(204,0,0,0.1);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-label {
  font-size: 12px;
  color: #666666;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: #111111;
  margin-bottom: 8px;
}

.kpi-unit {
  font-size: 14px;
  font-weight: 400;
  color: #444444;
}

.kpi-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.kpi-change.up {
  color: #059669;
  background: rgba(5, 150, 105, 0.1);
}

.kpi-change.down {
  color: #cc0000;
  background: rgba(204, 0, 0, 0.08);
}

.kpi-icon {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  gap: 20px;
}

.charts-grid.two-col {
  grid-template-columns: 1fr 1fr;
}

.charts-grid.three-col {
  grid-template-columns: 2fr 1fr;
}

.chart-card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chart-card:hover {
  background: #fffafa;
  box-shadow: 0 4px 16px rgba(204,0,0,0.08);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.chart-title {
  font-size: 15px;
  font-weight: 700;
  color: #111111;
}

.chart-subtitle {
  font-size: 12px;
  color: #666666;
  margin-top: 3px;
}

.chart-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(204, 0, 0, 0.08);
  color: #cc0000;
  border: 1px solid rgba(204, 0, 0, 0.2);
}

.chart-container {
  position: relative;
  height: 240px;
}

.chart-container.tall {
  height: 300px;
}

.chart-container.short {
  height: 180px;
}

/* Room Status */
.room-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.room-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.room-cell:hover {
  transform: scale(1.1);
  z-index: 10;
}

.room-cell.occupied {
  background: linear-gradient(135deg, #c8963c, #a0722a);
  color: #fff;
}

.room-cell.vacant {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.room-cell.cleaning {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.room-cell.maintenance {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.room-number {
  font-size: 11px;
  font-weight: 700;
}

.room-status-text {
  font-size: 8px;
  margin-top: 2px;
}

/* Legend */
.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  color: #333333;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #cc0000;
  background: #fff5f5;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eeeeee;
  color: #222222;
  transition: background 0.2s;
}

.data-table tr:hover td {
  background: #fff8f8;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: rgba(5, 150, 105, 0.1);
  color: #059669;
}

.badge-red {
  background: rgba(204, 0, 0, 0.08);
  color: #cc0000;
}

.badge-blue {
  background: rgba(29, 78, 216, 0.1);
  color: #1d4ed8;
}

.badge-gold {
  background: rgba(204, 0, 0, 0.08);
  color: #cc0000;
}

/* Period selector */
.period-selector {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}

.period-btn {
  padding: 7px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #ffffff;
  color: #444444;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.period-btn:hover {
  border-color: #cc0000;
  color: #cc0000;
}

.period-btn.active {
  background: rgba(204, 0, 0, 0.08);
  border-color: #cc0000;
  color: #cc0000;
  font-weight: 600;
}

/* Occupancy gauge */
.gauge-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
}

.gauge-container {
  position: relative;
  width: 180px;
  height: 180px;
}

.gauge-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%);
  text-align: center;
}

.gauge-value {
  font-size: 32px;
  font-weight: 700;
  color: #111111;
}

.gauge-unit {
  font-size: 13px;
  color: #666666;
}

.gauge-sub {
  font-size: 11px;
  color: #666666;
  margin-top: 4px;
}

/* Summary row */
.summary-row {
  display: flex;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid #e0e0e0;
  margin-top: 14px;
}

.summary-item {
  text-align: center;
  flex: 1;
}

.summary-item .val {
  font-size: 18px;
  font-weight: 700;
  color: #111111;
}

.summary-item .lbl {
  font-size: 11px;
  color: #666666;
  margin-top: 3px;
}

/* Tab content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 1100px) {

  .charts-grid.two-col,
  .charts-grid.three-col {
    grid-template-columns: 1fr;
  }

  .room-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 768px) {
  .main {
    padding: 16px;
  }

  .header {
    padding: 0 16px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .room-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
  background: #cccccc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #cc0000;
}

.section-gap {
  margin-top: 20px;
}

/* ── 시뮬레이션 & 품목성장 스타일 ── */
.sim-controls {
  padding: 10px 5px;
  display: grid;
  gap: 20px;
}

.sim-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sim-group label {
  font-size: 13px;
  color: #333333;
  display: flex;
  justify-content: space-between;
  font-weight: 500;
}

.sim-group label span {
  color: #cc0000;
  font-weight: 700;
}

.sim-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.sim-summary-box {
  margin-top: 30px;
  padding: 20px;
  background: rgba(204, 0, 0, 0.04);
  border: 1px solid rgba(204, 0, 0, 0.15);
  border-radius: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  text-align: center;
}

.sim-sum-label {
  font-size: 12px;
  color: #555555;
  margin-bottom: 5px;
  font-weight: 500;
}

.sim-sum-value {
  font-size: 18px;
  font-weight: 700;
  color: #111111;
}

.sim-sum-value.highlight {
  color: #cc0000;
}

.item-row input {
  background: #ffffff;
  border: 1px solid #ddd;
  color: #111111;
  padding: 5px 8px;
  border-radius: 4px;
  width: 100%;
}

.growth-positive {
  color: #059669;
  font-weight: 700;
}

.growth-negative {
  color: #cc0000;
  font-weight: 700;
}

/* ── 시뮬레이션 판관비 입력 행 ── */
.sim-cost-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.sim-cost-row label {
  font-size: 13px;
  color: #444;
  font-weight: 500;
}

.sim-cost-row input[type="number"] {
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  text-align: right;
  color: #111;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.2s;
}

.sim-cost-row input[type="number"]:focus {
  outline: none;
  border-color: #cc0000;
  background: #fff;
}