/* ============================================================
   AIMA — Global Styles (Dark Modern UI)
   ============================================================ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; } /* Full screen constraint */
body {
  font-family: 'Segoe UI', 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  background: #0d0d12;
  color: #e0e0eb;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: filter 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn-sm   { padding: 0.35rem 0.9rem; font-size: 0.8rem; border-radius: 6px; }
.btn-xs   { padding: 0.25rem 0.65rem; font-size: 0.75rem; border-radius: 5px; }
.btn-block { width: 100%; }

.btn-primary { background: #4f46e5; color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #d0d0e0;
}
.btn-outline:hover { background: rgba(255,255,255,0.07); }
.btn-green  { background: #059669; color: #fff; }
.btn-red    { background: #dc2626; color: #fff; }
.btn-danger { background: #991b1b; color: #fff; }

/* ── Form ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}
.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #9090a8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
input[type="text"],
input[type="password"],
input[type="number"] {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  color: #e0e0eb;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
input:focus { border-color: #4f46e5; }
input::placeholder { color: #555570; }

/* ── Alerts ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-error   { background: rgba(220,38,38,0.18); border: 1px solid rgba(220,38,38,0.4); color: #fca5a5; }
.alert-success { background: rgba(5,150,105,0.18);  border: 1px solid rgba(5,150,105,0.4); color: #6ee7b7; }

/* ── Cards ── */
.card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 1.5rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #c7d2fe;
}

/* ── Misc ── */
.text-muted   { color: #72728a; font-size: 0.875rem; }
.highlight    { color: #818cf8; }
.link-muted   { color: #72728a; font-size: 0.85rem; }
.link-muted:hover { color: #a5b4fc; }

/* ============================================================
   AUTH PAGES (login / admin-login)
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(79,70,229,0.15) 0%, transparent 70%),
              #0d0d12;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  padding: 2.5rem 2rem;
}
.auth-logo {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.25rem;
}
.auth-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #9090a8;
  margin-bottom: 1.75rem;
}
.auth-form { display: flex; flex-direction: column; gap: 1.1rem; }
.auth-form .btn-block { margin-top: 0.25rem; padding: 0.7rem; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: #444460;
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.08);
}

/* ============================================================
   DASHBOARD — TOP BAR
   ============================================================ */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 1.5rem;
  height: 58px;
  background: rgba(13,13,18,0.85);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  z-index: 100;
  gap: 1rem;
}

/* 좌측 */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.topbar-id {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}
.topbar-sub {
  font-size: 0.8rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  white-space: nowrap;
}
.sub-ok      { background: rgba(5,150,105,0.2);  color: #34d399; border: 1px solid rgba(5,150,105,0.35); }
.sub-warning { background: rgba(202,138,4,0.2);  color: #fbbf24; border: 1px solid rgba(202,138,4,0.35); }
.sub-danger  { background: rgba(220,38,38,0.2);  color: #f87171; border: 1px solid rgba(220,38,38,0.35); }

/* 중앙 */
.topbar-center {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: center;
}

/* 우측 */
.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* ============================================================
   DASHBOARD — REFINED LAYOUT (50% Canvas / 50% Split Bottom)
   ============================================================ */
.dash-body {
  height: calc(100vh - 58px); /* Full height minus topbar */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Office Canvas (Top 50%) ── */
.office-wrap {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}

#officeCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.ctrl-bar {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  background: rgba(13,13,18,0.7);
  backdrop-filter: blur(10px);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Bottom Area (Split 50/50 Horizontally) ── */
.bottom-row {
  flex: 1;
  display: flex;
  flex-direction: row;
  background: #0d0d12;
  overflow: hidden;
}

.bottom-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
}
.bottom-col:last-child  { border-right: none; }
.bottom-col-full        { flex: 1 1 100%; border-right: none; }

.section-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #475569;
  padding: 0.7rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(255,255,255,0.01);
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.chat-msg {
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.6;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  padding-bottom: 0.3rem;
}
.chat-name {
  font-weight: 700;
  /* color은 인라인 style로 에이전트별 설정 */
  margin-right: 0.4rem;
  flex-shrink: 0;
}
.chat-timer {
  display: inline-block;
  color: #facc15;
  font-weight: 800;
  font-family: monospace;
  font-size: 0.78rem;
  background: rgba(250,204,21,0.12);
  border: 1px solid rgba(250,204,21,0.25);
  border-radius: 4px;
  padding: 0 0.35rem;
  margin-left: 0.3rem;
  min-width: 3rem;
  text-align: center;
  vertical-align: baseline;
}

/* ── Progress Strip (채팅 컬럼 상단 진행바 영역) ── */
.progress-strip {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.2);
  min-height: 0;
}
.progress-strip:empty { display: none; }

.ps-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
}
.ps-name {
  font-weight: 700;
  width: 58px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-bar-wrap {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  min-width: 40px;
}
.ps-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
  opacity: 0.85;
}
.ps-pct {
  color: #64748b;
  width: 28px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.ps-msg {
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* ── Status Column Content ── */
.status-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.status-item {
  background: rgba(255,255,255,0.03);
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.05);
}
.status-label { font-size: 0.75rem; color: #64748b; margin-bottom: 0.25rem; }
.status-value { font-size: 0.9rem; font-weight: 600; color: #f1f5f9; }

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
  .bottom-row { flex-direction: column; }
  .office-wrap { height: 40%; }
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
  .topbar {
    grid-template-columns: 1fr auto;
    height: auto;
    padding: 0.75rem;
  }
  .topbar-center { display: none; } /* Hide complicated stuff on small mobile header */
  
  .ctrl-bar {
    top: auto;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    width: auto;
    justify-content: center;
  }
  
  .bottom-panel {
    width: auto;
    left: 1.5rem;
    right: 1.5rem;
    bottom: 6rem; /* Above ctrl bar */
    height: 180px;
  }
}

/* ── Admin Styles ── */
.admin-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  overflow-y: auto;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

