/* aztech.css — Tailwind 보완 커스텀 CSS */

/* Material Symbols 기본 설정 */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.material-symbols-outlined.fill {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* 스크롤바 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* 사이드바 활성 메뉴 */
.active-nav {
  background-color: rgba(25, 127, 230, 0.1);
  color: #197fe6;
  border-left: 3px solid #197fe6;
}

/* 상태 배지 */
.badge-run    { background: #dcfce7; color: #078838; }
.badge-warn   { background: #fefce8; color: #a16207; }
.badge-alarm  { background: #fee2e2; color: #e73908; }
.badge-off    { background: #f1f5f9; color: #64748b; }

/* severity 행 — 좌측 세로 바 */
tr.severity-trip    { box-shadow: inset 3px 0 0 #e73908; }
tr.severity-alarm   { box-shadow: inset 3px 0 0 #f97316; }
tr.severity-warning { box-shadow: inset 3px 0 0 #eab308; }

/* 테이블 공통 */
.az-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.az-table th {
  background: #f8fafc;
  padding: 0.625rem 0.875rem;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.az-table td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.az-table tbody tr:hover { background: #f8fafc; }

/* 카드 공통 */
.az-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem;
}

/* 상태 점 */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.run    { background: #078838; box-shadow: 0 0 0 3px rgba(7,136,56,.15); }
.status-dot.warn   { background: #eab308; }
.status-dot.alarm  { background: #e73908; box-shadow: 0 0 0 3px rgba(231,57,8,.15); }
.status-dot.off    { background: #64748b; }

/* 소모품 잔여 바 */
.progress-bar-wrap { background: #f1f5f9; border-radius: 9999px; height: 6px; overflow: hidden; }
.progress-bar      { height: 100%; border-radius: 9999px; transition: width 0.4s ease; }
.progress-bar.ok   { background: #078838; }
.progress-bar.warn { background: #eab308; }
.progress-bar.crit { background: #e73908; }

/* 모달 오버레이 */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.5rem;
  width: 100%; max-width: 540px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

/* 폼 입력 공통 */
.az-input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #1e293b;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.az-input:focus { border-color: #197fe6; box-shadow: 0 0 0 3px rgba(25,127,230,.12); }
.az-label { display: block; font-size: 0.8125rem; font-weight: 600; color: #374151; margin-bottom: 0.375rem; }

/* 버튼 */
.btn-primary {
  background: #197fe6; color: #fff;
  border: none; border-radius: 0.375rem;
  padding: 0.5rem 1.25rem; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover { background: #1568c2; }
.btn-secondary {
  background: #f1f5f9; color: #475569;
  border: 1px solid #e2e8f0; border-radius: 0.375rem;
  padding: 0.5rem 1.25rem; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger {
  background: #fee2e2; color: #e73908;
  border: none; border-radius: 0.375rem;
  padding: 0.5rem 1.25rem; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: #fecaca; }

/* ── 알람 행 플래시 (테이블 tr용) ── */
@keyframes alarmRowFlash {
  0%, 100% { background-color: transparent;           box-shadow: none; }
  50%       { background-color: rgba(231, 57, 8, 0.12); box-shadow: inset 3px 0 0 #e73908; }
}
@keyframes alarmRowFlashDark {
  0%, 100% {
    background-color: transparent;
    box-shadow: inset 3px 0 0 transparent;
  }
  50% {
    background-color: rgba(255, 80, 0, 0.28);
    box-shadow: inset 3px 0 0 #ff6b6b;
  }
}
.tr-alarm-flash {
  animation: alarmRowFlash 1.4s ease-in-out infinite;
}

/* ── 알람 카드 플래시 ── */
@keyframes alarmFlash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 57, 8, 0); background-color: #ffffff; }
  50%       { box-shadow: 0 0 0 4px rgba(231, 57, 8, 0.35); background-color: #fff1f1; }
}
.card-alarm-flash {
  animation: alarmFlash 1.2s ease-in-out infinite;
}
@keyframes alarmFlashDark {
  0%, 100% { box-shadow: 0 4px 24px rgba(0,0,0,.40), 0 0 0 0 rgba(255,107,107,0);    background-color: #162035; }
  50%       { box-shadow: 0 4px 24px rgba(0,0,0,.40), 0 0 0 4px rgba(255,107,107,.4); background-color: #2a1515; }
}

/* ── Gauge (스피도미터) ── */
.gauge-track     { stroke: #e2e8f0; }
.gauge-val,
.gauge-grade     { fill: #1e293b; }
.gauge-lbl       { fill: #94a3b8; }
.gauge-needle    { stroke: #475569; }
.gauge-hub       { fill: #1e293b; }
.gauge-hub-inner { fill: #ffffff; }
.gauge-dot       { fill: #197fe6; }

html.dark .gauge-track     { stroke: #334155; }
html.dark .gauge-val,
html.dark .gauge-grade     { fill: #f1f5f9; }
html.dark .gauge-lbl       { fill: #475569; }
html.dark .gauge-needle    { stroke: #94a3b8; }
html.dark .gauge-hub       { fill: #94a3b8; }
html.dark .gauge-hub-inner { fill: #1e293b; }
html.dark .gauge-dot       { fill: #60a5fa; }

/* 설정 서브메뉴 */
.sb-submenu { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.sb-submenu.open { max-height: 200px; }
#sidebar.sb-collapsed .sb-submenu { max-height: 0 !important; }
#sidebar.sb-collapsed .sb-settings-chevron { display: none; }
.sb-bullet { font-size: 1rem; line-height: 1; flex-shrink: 0; }

/* ── Sidebar toggle ── */
#sidebar { transition: width 0.25s ease; }
#sidebar.sb-collapsed { width: 3.5rem; }
#sidebar.sb-collapsed .sb-label,
#sidebar.sb-collapsed .sb-brand,
#sidebar.sb-collapsed .sb-user-name,
#sidebar.sb-collapsed .sb-logout-label { display: none; }
#sidebar.sb-collapsed nav a { justify-content: center; padding-left: 0.25rem; padding-right: 0.25rem; }
#sidebar.sb-collapsed .sb-toggle-icon { transform: rotate(180deg); }
#sidebar.sb-collapsed .active-nav { border-left: none; border-radius: 0.5rem; }
#sidebar.sb-collapsed #sidebarToggleBtn { justify-content: center; }

/* Mobile overlay */
#sidebarOverlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 40;
}
#sidebarOverlay.active { display: block; }

/* Mobile sidebar */
@media (max-width: 767px) {
  #sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    width: 200px !important; transform: translateX(-100%);
    z-index: 50; transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  #sidebar.mobile-open { transform: translateX(0); }
  .sb-mobile-btn { display: flex !important; }
  .sb-desktop-toggle { display: none !important; }
  .az-table { font-size: 0.75rem; }
  .az-table th, .az-table td { padding: 0.5rem; }
}
@media (min-width: 768px) {
  .sb-mobile-btn { display: none !important; }
}

/* ── Dark Mode ── */
html.dark {
  color-scheme: dark;
}

/* ── 색상 팔레트
   배경 레이어:  #080e1a (최하단) → #0f1829 (본문) → #162035 (카드) → #1c2b44 (강조)
   텍스트:       #ffffff (제목)  → #d0dae8 (본문) → #7a8fa6 (보조) → #3d5068 (비활성)
   액센트:       #3b9eff (primary) / #34d986 (run) / #fbbf24 (warn) / #ff6b6b (alarm)
──────────────────────────────────────────────── */
html.dark body { background-color: #0f1829; color: #d0dae8; }

/* 배경 계층 */
html.dark .bg-white     { background-color: #162035 !important; }
html.dark .bg-slate-50  { background-color: #0f1829 !important; }
html.dark .bg-slate-100 { background-color: #1c2b44 !important; }
html.dark .bg-slate-200 { background-color: #223352 !important; }

/* ── 카드 — 테두리 제거, 그림자로 부유감 ── */
html.dark .az-card {
  background-color: #162035;
  border-color: transparent;
  box-shadow: 0 4px 24px rgba(0,0,0,0.40), 0 1px 4px rgba(0,0,0,0.25);
}

/* 텍스트 */
html.dark .text-slate-900 { color: #ffffff   !important; }
html.dark .text-slate-800 { color: #eaf0fa   !important; }
html.dark .text-slate-700 { color: #d0dae8   !important; }
html.dark .text-slate-600 { color: #a8b8cc   !important; }
html.dark .text-slate-500 { color: #7a8fa6   !important; }
html.dark .text-slate-400 { color: #4e6278   !important; }
html.dark .text-slate-300 { color: #3d5068   !important; }

/* 상태 색상 — 선명한 네온 계열 */
html.dark .text-st-run   { color: #34d986 !important; }
html.dark .text-st-warn  { color: #fbbf24 !important; }
html.dark .text-st-alarm { color: #ff6b6b !important; }
html.dark .text-st-off   { color: #7a8fa6 !important; }

/* 상태 점 */
html.dark .status-dot.run   { background: #34d986; box-shadow: 0 0 0 3px rgba(52,217,134,.2); }
html.dark .status-dot.warn  { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.2); }
html.dark .status-dot.alarm { background: #ff6b6b; box-shadow: 0 0 0 3px rgba(255,107,107,.2); }
html.dark .status-dot.off   { background: #4e6278; }

/* 배지 — 반투명 배경 + 밝은 텍스트 */
html.dark .bg-green-100    { background-color: rgba(52,217,134,.14)  !important; }
html.dark .text-green-700  { color: #34d986 !important; }
html.dark .bg-yellow-100   { background-color: rgba(251,191,36,.14)  !important; }
html.dark .text-yellow-700 { color: #fbbf24 !important; }
html.dark .bg-red-100      { background-color: rgba(255,107,107,.14) !important; }
html.dark .text-red-700    { color: #ff6b6b !important; }
html.dark .bg-orange-100   { background-color: rgba(251,146,60,.14)  !important; }
html.dark .text-orange-500 { color: #fb923c !important; }

/* 보더 */
html.dark .border-slate-200 { border-color: #1c2b44 !important; }
html.dark .border-slate-100 { border-color: #162035 !important; }
html.dark .border-b { border-color: #1c2b44; }

/* ── 테이블 ── */
html.dark .az-table th {
  background-color: #0f1829;
  color: #7a8fa6;
  border-bottom-color: #1c2b44;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}
html.dark .az-table td {
  border-bottom-color: #162035;
  color: #d0dae8;
}
html.dark .az-table tbody tr:hover { background-color: #1c2e48 !important; }
html.dark tr.severity-trip    { box-shadow: inset 3px 0 0 #ff4444 !important; }
html.dark tr.severity-alarm   { box-shadow: inset 3px 0 0 #fb923c !important; }
html.dark tr.severity-warning { box-shadow: inset 3px 0 0 #fbbf24 !important; }

/* 입력 */
html.dark .az-input {
  background-color: #0f1829;
  border-color: #1c2b44;
  color: #d0dae8;
}
html.dark .az-input:focus {
  border-color: #3b9eff;
  box-shadow: 0 0 0 3px rgba(59,158,255,.15);
}

/* 버튼 */
html.dark .btn-secondary {
  background-color: #1c2b44;
  border-color: #223352;
  color: #a8b8cc;
}
html.dark .btn-secondary:hover { background-color: #223352; }

/* 설정 서브메뉴 */
html.dark .sb-submenu a { color: #4e6278; }
html.dark .sb-submenu a:hover { background-color: #1c2e48 !important; color: #7a8fa6 !important; }
html.dark .sb-submenu a.text-primary { color: #60a5fa !important; background-color: rgba(59,158,255,.12) !important; }

/* 사이드바 */
html.dark #sidebar { background-color: #111e30; border-right-color: #1c2b44; }
html.dark #sidebar .border-b { border-color: #1c2b44; }
html.dark #sidebar .border-t { border-color: #1c2b44; }
html.dark .active-nav { background-color: rgba(59,158,255,.15); color: #60a5fa; }
html.dark .text-slate-500.hover\:bg-slate-50:hover { background-color: #0f1829 !important; }

/* 헤더 */
html.dark header { background-color: #111e30; border-bottom-color: #1c2b44; }

/* 모달 */
html.dark .modal-box {
  background-color: #162035;
  color: #d0dae8;
  border: 1px solid #1c2b44;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}

/* hover */
html.dark .hover\:bg-slate-50:hover  { background-color: #1c2e48 !important; }
html.dark .hover\:bg-slate-100:hover { background-color: #223352 !important; }

/* aside 알람 패널 */
html.dark aside.w-72 { background-color: #162035; border-left-color: #1c2b44; }
html.dark .bg-red-50    { background-color: #2a1515 !important; }
html.dark .bg-orange-50 { background-color: #2a1f15 !important; }
html.dark .bg-yellow-50 { background-color: #2a2715 !important; }

/* progress bar */
html.dark .progress-bar-wrap { background: #1c2b44; }

/* 스크롤바 */
html.dark ::-webkit-scrollbar-track { background: #0f1829; }
html.dark ::-webkit-scrollbar-thumb { background: #1c2b44; border-radius: 10px; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #223352; }

/* inline bg-slate */
html.dark [class*="bg-slate-50"] { background-color: #0f1829 !important; }

/* 알람 플래시 — 다크모드 */
html.dark .card-alarm-flash  { animation-name: alarmFlashDark; }
html.dark .tr-alarm-flash    { animation-name: alarmRowFlashDark; animation-duration: 1.4s; }

/* 토글 버튼 아이콘 */
#darkToggleIcon.light { display: none; }
html.dark #darkToggleIcon.light { display: block; }
html.dark #darkToggleIcon.dark  { display: none; }
