/* ============================
   건설 현장 스마트 모니터링 시스템
   공통 스타일 시트
   Design: Dark Navy + Orange
   ============================ */

:root {
  --navy-darkest: #0F172A;
  --navy-dark:    #1E293B;
  --navy-mid:     #263548;
  --navy-light:   #334155;
  --navy-border:  #3E5068;
  --orange:       #F97316;
  --orange-light: #FB923C;
  --orange-dark:  #EA6C0A;
  --orange-glow:  rgba(249,115,22,0.18);
  --text-primary:   #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted:     #64748B;
  --success:  #22C55E;
  --warning:  #F59E0B;
  --danger:   #EF4444;
  --info:     #38BDF8;
  --card-bg:  rgba(38,53,72,0.85);
  --card-border: rgba(62,80,104,0.7);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.45);
  --shadow-orange: 0 4px 24px rgba(249,115,22,0.22);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans KR', 'Pretendard', -apple-system, sans-serif;
  background-color: var(--navy-darkest);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--navy-dark); }
::-webkit-scrollbar-thumb { background: var(--navy-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--orange); }

/* ============================
   NAVIGATION
   ============================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,23,42,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--navy-border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.navbar-brand .brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: var(--shadow-orange);
}
.navbar-brand .brand-sub {
  font-size: 0.7rem;
  color: var(--orange);
  display: block;
  line-height: 1;
}
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}
.navbar-nav a {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--orange);
  background: var(--orange-glow);
}
.navbar-nav a.active {
  font-weight: 600;
}
.nav-cta {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark)) !important;
  color: #fff !important;
  font-weight: 600 !important;
  padding: 0.5rem 1.2rem !important;
  box-shadow: var(--shadow-orange);
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(249,115,22,0.4) !important; }

/* ============================
   LAYOUT CONTAINERS
   ============================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 1.5rem; }
.page-content { padding: 2.5rem 0 4rem; }

/* ============================
   CARDS
   ============================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2, .card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-body { padding: 1.5rem; }

/* ============================
   BUTTONS
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #fff;
  box-shadow: var(--shadow-orange);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(249,115,22,0.45); transform: translateY(-1px); }
.btn-secondary {
  background: var(--navy-light);
  color: var(--text-primary);
  border: 1px solid var(--navy-border);
}
.btn-secondary:hover { background: var(--navy-border); }
.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--navy-border);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--navy-light); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ============================
   FORM ELEMENTS
   ============================ */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.form-label .required { color: var(--orange); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 0.7rem 1rem;
  background: rgba(15,23,42,0.7);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.form-control:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
  background: rgba(15,23,42,0.9);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394A3B8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 14px;
  padding-right: 2.5rem;
  cursor: pointer;
}
select.form-control option { background: var(--navy-dark); color: var(--text-primary); }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }

/* Range Slider */
.range-wrap { position: relative; }
input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--navy-border);
  border-radius: 3px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--orange);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(249,115,22,0.5);
  cursor: pointer;
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
.range-value {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  min-width: 52px;
  text-align: center;
}

/* ============================
   STATUS BADGES
   ============================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.badge-normal  { background: rgba(34,197,94,0.15);  color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.badge-caution { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.3); }
.badge-info    { background: rgba(56,189,248,0.15); color: var(--info);    border: 1px solid rgba(56,189,248,0.3); }

/* ============================
   STATUS LEVEL DISPLAY
   ============================ */
.status-block {
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.status-block.normal  { background: rgba(34,197,94,0.1);  border: 2px solid rgba(34,197,94,0.4); }
.status-block.caution { background: rgba(245,158,11,0.1); border: 2px solid rgba(245,158,11,0.4); }
.status-block.danger  { background: rgba(239,68,68,0.1);  border: 2px solid rgba(239,68,68,0.4); }
.status-score {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.status-block.normal  .status-score { color: var(--success); }
.status-block.caution .status-score { color: var(--warning); }
.status-block.danger  .status-score { color: var(--danger); }
.status-label { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.5rem; }
.status-desc  { color: var(--text-secondary); font-size: 0.9rem; }

/* ============================
   SCORE BARS
   ============================ */
.score-bar-wrap { margin-bottom: 0.85rem; }
.score-bar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.score-bar-label  { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.score-bar-value  { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.score-bar-bg {
  height: 8px;
  background: var(--navy-border);
  border-radius: 4px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.score-bar-fill.high   { background: linear-gradient(90deg, var(--success), #16A34A); }
.score-bar-fill.medium { background: linear-gradient(90deg, var(--warning), #D97706); }
.score-bar-fill.low    { background: linear-gradient(90deg, var(--danger),  #B91C1C); }

/* ============================
   STAT CARDS
   ============================ */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.orange { background: var(--orange-glow); color: var(--orange); }
.stat-icon.green  { background: rgba(34,197,94,0.12);  color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-icon.red    { background: rgba(239,68,68,0.12);  color: var(--danger); }
.stat-icon.blue   { background: rgba(56,189,248,0.12); color: var(--info); }
.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.2rem; }
.stat-value { font-size: 1.65rem; font-weight: 800; line-height: 1.1; }
.stat-sub   { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ============================
   TABLE
   ============================ */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table thead th {
  padding: 0.75rem 1rem;
  background: rgba(15,23,42,0.6);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--navy-border);
  text-align: left;
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid rgba(62,80,104,0.4);
  transition: background 0.15s;
}
.data-table tbody tr:hover { background: rgba(249,115,22,0.05); }
.data-table tbody td {
  padding: 0.8rem 1rem;
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tbody td:first-child { color: var(--text-primary); font-weight: 500; }

/* ============================
   ALERTS & TOAST
   ============================ */
.alert {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.05rem; }
.alert-info    { background: rgba(56,189,248,0.1);  border-left: 3px solid var(--info);    color: var(--info); }
.alert-success { background: rgba(34,197,94,0.1);   border-left: 3px solid var(--success); color: var(--success); }
.alert-warning { background: rgba(245,158,11,0.1);  border-left: 3px solid var(--warning); color: var(--warning); }
.alert-danger  { background: rgba(239,68,68,0.1);   border-left: 3px solid var(--danger);  color: var(--danger); }

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideInRight 0.3s ease;
  border-left: 3px solid;
}
.toast-success { background: rgba(34,197,94,0.18);  border-color: var(--success); color: var(--success); }
.toast-error   { background: rgba(239,68,68,0.18);  border-color: var(--danger);  color: var(--danger); }
.toast-info    { background: rgba(56,189,248,0.18); border-color: var(--info);    color: var(--info); }
@keyframes slideInRight { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================
   LOADING SPINNER
   ============================ */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(249,115,22,0.2);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.75);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 9998; gap: 1rem;
}
.loading-overlay .spinner { width: 44px; height: 44px; border-width: 4px; }
.loading-overlay p { color: var(--text-secondary); font-size: 0.9rem; }

/* ============================
   PAGE HEADER
   ============================ */
.page-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--navy-border);
  margin-bottom: 2rem;
}
.page-header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.page-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; display: flex; align-items: center; gap: 0.6rem; }
.page-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }
.page-title-icon {
  width: 42px; height: 42px;
  background: var(--orange-glow);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: var(--orange);
  border: 1px solid rgba(249,115,22,0.3);
}

/* ============================
   SECTION DIVIDERS
   ============================ */
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--navy-border); }

/* ============================
   EMPTY STATE
   ============================ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.88rem; }

/* ============================
   MODAL
   ============================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.8);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--navy-dark);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 100%;
  overflow: hidden;
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--navy-border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; padding: 0.25rem; transition: color 0.15s; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--navy-border); display: flex; justify-content: flex-end; gap: 0.75rem; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================
   FILTER BAR
   ============================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.filter-bar .form-control { max-width: 200px; }

/* ============================
   WEATHER ICONS
   ============================ */
.weather-icon { font-size: 1.1rem; }

/* ============================
   PRINT STYLES
   ============================ */
@media print {
  .navbar, .btn, .filter-bar, #toast-container { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; box-shadow: none; background: #fff; }
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .navbar-nav { display: none; }
  .navbar-nav.open { display: flex; flex-direction: column; position: fixed; top: 64px; left: 0; right: 0; background: var(--navy-darkest); padding: 1rem; border-bottom: 1px solid var(--navy-border); }
  .hamburger { display: flex; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .page-title { font-size: 1.3rem; }
  .stat-card { padding: 1rem; }
}
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: all 0.2s; }

/* ============================
   UTILS
   ============================ */
.text-orange  { color: var(--orange); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 0.82rem; }
.text-center  { text-align: center; }
.fw-bold      { font-weight: 700; }
.fw-black     { font-weight: 900; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
