/* =========================
   DCSFM Dashboard - style.css
   (중복 없이 단일 정의)
   ========================= */

/* ---- Theme + Shrink Vars (JS가 변경) ---- */
:root{
  --black: #0b0b0b;
  --white: #ffffff;
  --gold:  #c9a24d;

  --text-main: #111111;
  --text-muted:#6b7280;

  --radius-lg: 16px;
  --radius-sm: 10px;

  --shadow-soft:   0 10px 30px rgba(0,0,0,0.08);
  --shadow-strong: 0 18px 45px rgba(0,0,0,0.15);

  /* JS가 실시간으로 바꾸는 값들 */
  --headerH: 180px;      /* 처음 진입 시 크게 보이게 */
  --logoSize: 88px;
  --titleSize: 40px;
  --subSize: 14px;
  --tabsPadBottom: 10px;
  --headerH-max: 180px; /* 너의 '처음 큰 헤더' 높이와 동일하게 */
}

/* ===== Reset ===== */
*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:#f7f7f7;
  color:var(--text-main);
}

/* =========================================
   Header (툴바 정렬 핵심)
   - topbar: fixed + grid
   - 왼쪽: brand, 오른쪽: tabs
   ========================================= */
/* ===== Header: 검은 배경(틀) 고정 + 탭은 항상 바닥 ===== */
.topbar{
  position: fixed;
  top:0; left:0; right:0;
  z-index:999;

  height: var(--headerH); /* ✅ 줄어드는 높이 */
  background: linear-gradient(135deg, #0b0b0b, #141414);
  border-bottom: 2px solid var(--gold);

  transition: height 0.25s ease;

  /* 탭을 헤더 바닥에 고정하기 위한 기준 */
  overflow: hidden;       /* ✅ 헤더 밖으로 절대 못 나가게 */
}



/* brand 영역 */
.brand{
  max-width: 1200px;
  margin: 0 auto;

  display:flex;
  align-items:center;
  justify-content: center;
  gap:14px;

  padding: 25px 20px 0;   /* 위 여백만 */
  padding-bottom: 0;      /* ✅ 제거 */
}




/* 로고(배지) */
.logo-badge{
  width: var(--logoSize);
  height: var(--logoSize);
  border-radius: 18px;

  background: linear-gradient(135deg, var(--gold), #e6c87a);
  color:#000;
  font-weight: 900;
  font-size: 18px;

  display:flex;
  align-items:center;
  justify-content:center;

  box-shadow: var(--shadow-strong);
  transition: width 0.25s ease, height 0.25s ease;
}

.brand-title{
  font-size: var(--titleSize);
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 1px;
  line-height: 1.05;
  transition: font-size 0.25s ease;
}
.brand-sub{
  font-size: var(--subSize);
  color: rgba(255,255,255,0.78);
  transition: font-size 0.25s ease;
}
.brand-text{
  display: flex;
  flex-direction: column;
  justify-content: center;
}


/* tabs 영역 */
/* ===== Tabs: 검은 헤더 바닥에 고정 ===== */
.tabs{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;              /* 헤더 아래쪽 여백 */
  
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;

  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}


/* 탭 버튼 */
.tab{
  padding: 8px 14px;
  font-size: 14px;

  border-radius: 999px;
  border: 1px solid rgba(201,162,77,0.45);
  background: transparent;
  color: rgba(255,255,255,0.92);

  cursor:pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.tab:hover{
  background: rgba(201,162,77,0.14);
}
.tab.is-active{
  background: var(--gold);
  color:#000;
  box-shadow: var(--shadow-soft);
}

/* ===== Layout ===== */
/* fixed 헤더 뒤로 본문이 가려지지 않게: headerH만큼 위 패딩 */
.container{
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--headerH-max) + 22px) 20px 40px;
}



/* 패널 탭 전환 */
.panel{ display:none; }
.panel.is-visible{ display:block; }

/* ===== Typography ===== */
.h1{
  font-size: 32px;
  margin: 10px 0 6px;
  letter-spacing: -0.5px;
}
.h2{
  font-size: 17px;
  margin: 0 0 10px;
  color: #000;
}
.muted{
  color: var(--text-muted);
  margin-bottom: 20px;
}
.p{ line-height: 1.7; }

/* ===== Cards ===== */
.grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:18px;
}
@media (max-width: 900px){
  .grid{ grid-template-columns: 1fr; }
}

.card{
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px;
  border-top: 4px solid var(--gold);
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover{
  transform: translateY(-4px);
  box-shadow: var(--shadow-strong);
}

/* 리스트 */
.list{ margin:0; padding-left:18px; }

/* ===== Server Check ===== */
.row{
  display:flex;
  gap:12px;
  align-items:center;
  margin:14px 0;
  flex-wrap:wrap;
}
.btn{
  background: linear-gradient(135deg, #0b0b0b, #1a1a1a);
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 900;
  cursor:pointer;
  transition: all 0.25s ease;
}
.btn:hover{
  background: var(--gold);
  color:#000;
}
.pill{
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 900;
  background: rgba(201,162,77,0.15);
  border: 1px solid var(--gold);
}
.code{
  background: #0b0b0b;
  color: #f5f5f5;
  border-radius: var(--radius-lg);
  padding: 16px;
  border-left: 4px solid var(--gold);
  font-size: 13px;
  overflow-x:auto;
}

/* ===== Key-Value ===== */
.kv{
  display:flex;
  justify-content:space-between;
  padding: 10px 0;
  border-bottom: 1px dashed #e5e5e5;
}
.kv:last-child{ border-bottom:none; }

/* ===== Note ===== */
.note{
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: rgba(201,162,77,0.1);
  border-left: 4px solid var(--gold);
  font-size: 14px;
}

/* ===== Footer ===== */
.footer{
  max-width: 1200px;
  margin: 10px auto 30px;
  padding: 0 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Responsive: 작은 화면에서는 탭이 아래로 내려가도 깔끔하게 ===== */
@media (max-width: 860px){
  .tabs{
    flex-wrap: nowrap;        /* 줄바꿈 금지 */
    overflow-x: auto;         /* 가로 스크롤 */
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}

/* ===== Architecture Diagram ===== */
.architecture-wrap {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  overflow: auto;              /* ⭐ 큰 다이어그램 스크롤 */
}

.architecture-img {
  display: block;
  max-width: 100%;
  min-width: 900px;            /* ⭐ 작아지지 않게 */
  height: auto;
}

/* ===== Architecture Page Layout ===== */
.arch-block {
  margin-bottom: 18px;
}

.arch-details {
  display: grid;
  gap: 16px;
}

/* 카드 형태 */
.arch-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border-top: 4px solid var(--gold);
  overflow: hidden;
}

.arch-head {
  padding: 14px 18px 0;
}

.arch-body {
  padding: 12px 18px 18px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
  align-items: start;
}

.arch-img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
}

/* 설명 리스트 */
.arch-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}

/* 전체 구조도 영역 */
.architecture-wrap {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
  overflow: auto;
}

.architecture-img {
  display: block;
  max-width: 100%;
  min-width: 900px;
  height: auto;
}

/* ===== Team Logo ===== */
.team-logo-wrap{
  display: flex;
  margin: 14px 0 18px;
}

.team-logo{
  width: min(520px, 92%);
  height: auto;
}

/* ===== Team Cards ===== */
.team-grid{
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

@media (max-width: 900px){
  .team-grid{
    grid-template-columns: 1fr;
  }
}

.team-card{
  padding: 18px 20px;
}

.team-name{
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 10px;
  color: #000;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}

.team-role{
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
  font-size: 14px;
  color: #333;
}

.team-role li{
  margin-bottom: 6px;
}

/* ===== Contact Section ===== */
.contact-item {
  margin: 10px 0 14px;
  font-size: 16px;
}

.contact-label {
  display: inline-block;
  min-width: 80px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.contact-value {
  font-size: 17px;
  font-weight: 700;
  color: #111;
}

.contact-link {
  color: #111;
  text-decoration: none;
  border-bottom: 2px solid rgba(201,162,77,0.4);
  transition: all 0.2s ease;
}

.contact-link:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ===== System Status colors ===== */
.status-ok {
  color: #000;
  background: rgba(201,162,77,0.25);
  border: 1px solid rgba(201,162,77,0.6);
  padding: 4px 10px;
  border-radius: 999px;
}

.status-bad {
  color: #fff;
  background: rgba(220, 38, 38, 0.85);
  border: 1px solid rgba(220, 38, 38, 0.9);
  padding: 4px 10px;
  border-radius: 999px;
}

/* =========================
   Dashboard
========================= */

.dashboard-controls {
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.dashboard-update {
  margin-left: auto;
  color: #657085;
  font-size: 14px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.dashboard-card {
  min-height: 150px;
}

.dashboard-value {
  margin-top: 12px;
  font-size: 42px;
  font-weight: 800;
  color: #111111;
}

.dashboard-label {
  margin-top: 4px;
  color: #657085;
  font-size: 14px;
}

.cube-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.cube-summary span {
  padding: 7px 10px;
  border: 1px solid #dddddd;
  border-radius: 12px;
  font-size: 13px;
}

.cube-summary b {
  margin-left: 5px;
}

.control-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-start {
  background: #d7ad4d;
  color: #111111;
}

.btn-estop {
  background: #b42318;
  border-color: #b42318;
  color: #ffffff;
}

.btn-estop:hover {
  background: #8f1c14;
}

.status-online {
  color: #16794b;
}

.status-danger {
  color: #b42318;
}

.recent-orders-card {
  margin-top: 22px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.orders-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.orders-table th,
.orders-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #e5e5e5;
  text-align: center;
  font-size: 14px;
}

.orders-table th {
  background: #111111;
  color: #d9b253;
  font-weight: 700;
}

.orders-table tbody tr:hover {
  background: #faf7ef;
}

.empty-row {
  padding: 30px !important;
  color: #7b8495;
}

.order-status {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eeeeee;
  font-size: 12px;
  font-weight: 700;
}

.status-pending {
  background: #f2f2f2;
  color: #444444;
}

.status-packing {
  background: #fff2c7;
  color: #725500;
}

.status-transporting {
  background: #dbeafe;
  color: #174ea6;
}

.status-completed {
  background: #dff5e8;
  color: #16794b;
}

.status-failed,
.status-stopped {
  background: #fee4e2;
  color: #b42318;
}

@media (max-width: 700px) {
  .dashboard-update {
    width: 100%;
    margin-left: 0;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .control-buttons {
    flex-direction: column;
  }

  .control-buttons .btn {
    width: 100%;
  }
}

/* =========================
   Orders Page
========================= */

.orders-summary-grid {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(150px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.order-metric-card {
  display: flex;
  flex-direction: column;
  min-height: 145px;
}

.order-metric-label {
  font-size: 16px;
  font-weight: 700;
}

.order-metric-value {
  margin-top: 12px;
  font-size: 42px;
  line-height: 1;
}

.order-metric-card small {
  margin-top: auto;
  color: #687386;
}

.orders-monitor-card,
.orders-receive-card {
  margin-top: 22px;
}

.orders-monitor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.orders-receive-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(220px, 1fr));
  gap: 12px 24px;
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .orders-summary-grid {
    grid-template-columns:
      repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 600px) {
  .orders-summary-grid {
    grid-template-columns: 1fr;
  }

  .orders-receive-grid {
    grid-template-columns: 1fr;
  }

  .orders-monitor-header {
    flex-direction: column;
  }
}

/* =========================
   TurtleBot Page
========================= */

.turtlebot-layout {
  display: grid;
  grid-template-columns:
    minmax(0, 1.3fr)
    minmax(340px, 0.9fr);
  gap: 22px;
  margin-top: 18px;
}

.turtlebot-status-area {
  min-width: 0;
}

.turtlebot-large-value {
  margin-top: 12px;
  font-size: 42px;
  font-weight: 800;
}

.battery-track {
  width: 100%;
  height: 12px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e8e8;
}

.battery-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: #d7ad4d;
  transition: width 0.3s ease;
}

.turtlebot-camera-card {
  min-width: 0;
}

.camera-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.camera-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-top: 16px;
  overflow: hidden;
  border: 2px solid #d0a33f;
  border-radius: 18px;
  background: #080808;
}

.camera-image {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.camera-placeholder {
  display: flex;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #d7ad4d;
  text-align: center;
}

.camera-placeholder span {
  color: #999999;
  font-size: 14px;
}

.camera-info-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(120px, 1fr));
  gap: 8px 18px;
  margin-top: 16px;
}

.turtlebot-raw-card {
  margin-top: 22px;
}

@media (max-width: 1050px) {
  .turtlebot-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .camera-info-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   UWB Position Monitor
========================= */

.uwb-monitor-card {
  margin-top: 22px;
}

.uwb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.uwb-layout {
  display: grid;
  grid-template-columns:
    minmax(0, 1.5fr)
    minmax(260px, 0.5fr);
  gap: 20px;
  margin-top: 18px;
}

.uwb-map-wrap {
  min-width: 0;
}

.uwb-map {
  position: relative;
  width: min(100%, 600px);
  aspect-ratio: 175 / 113;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid #d0a33f;
  border-radius: 18px;
  background:
    linear-gradient(
      rgba(0, 0, 0, 0.04) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.04) 1px,
      transparent 1px
    ),
    #fafafa;
  background-size: 40px 40px;
}

.uwb-anchor {
  position: absolute;
  width: 14px;
  height: 14px;
  z-index: 4;
  transform: translate(-50%, -50%);
  color: #111111;
  font-size: 13px;
}

.uwb-anchor strong {
  position: absolute;
  top: 20px;
  min-width: max-content;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 11px;
}

.anchor-dot {
  width: 14px;
  height: 14px;
  border: 3px solid #111111;
  border-radius: 50%;
  background: #d7ad4d;
}

.anchor-a1 {
  top: 3.5398%;
  left: 2.2857%;
}

.anchor-a2 {
  left: 2.2857%;
  top: 96.4602%;
}

.anchor-a3 {
  top: 3.5398%;
  left: 97.7143%;
}

.anchor-a4 {
  top: 96.4602%;
  left: 97.7143%;
}

.anchor-a3 strong,
.anchor-a4 strong {
  right: 0;
}

.anchor-a2 strong,
.anchor-a4 strong {
  top: auto;
  bottom: 20px;
}

.uwb-conveyor {
  position: absolute;
  top: calc(3.5398% + 18px);
  left: calc(2.2857% + 18px);
  width: 31%;
  height: 23%;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 2px solid #111111;
  border-radius: 12px;

  background:
    repeating-linear-gradient(
      90deg,
      #d9d9d9 0,
      #d9d9d9 18px,
      #c5c5c5 18px,
      #c5c5c5 22px
    );

  color: #111111;
  font-size: 13px;
  font-weight: 700;
  text-align: center;

}

.uwb-robot {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 10;
  transform: translate(-50%, -50%);
  transition:
    left 0.35s ease,
    top 0.35s ease;
}

.uwb-robot-dot {
  width: 22px;
  height: 22px;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: #b42318;
  box-shadow:
    0 0 0 3px #111111,
    0 4px 10px rgba(0, 0, 0, 0.25);
}

.uwb-robot strong {
  padding: 4px 7px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  font-size: 11px;
  white-space: nowrap;
}

.uwb-info-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.uwb-coordinate-note {
  margin-top: 14px;
  padding: 12px;
  border: 1px dashed #d0a33f;
  border-radius: 12px;
  background: #fffaf0;
  color: #657085;
  font-size: 13px;
}

@media (max-width: 950px) {
  .uwb-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {

  .uwb-conveyor {
    width: 31%;
    font-size: 12px;
  }
}
