/* =================================
   1. Global Variables & Reset
   ================================= */
:root {
  /* Color Palette */
  --primary-color: #6C63FF;
  /* Soft Purple - Main Action */
  --primary-hover: #5a52d5;
  --secondary-color: #FF6584;
  /* Soft Red - Danger/Emphasis */
  --secondary-hover: #e05471;
  --success-color: #00B894;
  /* Mint Green - Success */
  --warning-color: #FDCB6E;
  /* Soft Orange - Warning */
  --info-color: #0984E3;
  /* Blue - Info */

  --bg-color: #F0F2F5;
  /* Light Gray - Page Background */
  --card-bg: #FFFFFF;
  /* White - Component Background */
  --text-main: #2D3436;
  /* Dark Gray - Main Text */
  --text-muted: #636E72;
  /* Gray - Muted Text */
  --border-color: #DFE6E9;
  /* Light Border */

  /* Spacing & Radius */
  --border-radius: 12px;
  --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
  --box-shadow-hover: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);

  /* Navbar Height */
  --navbar-height: 70px;
}

body {
  font-family: 'Noto Sans KR', 'Segoe UI', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

/* =================================
   2. Typography & Common Utilities
   ================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.text-primary {
  color: var(--primary-color) !important;
}

.text-secondary {
  color: var(--secondary-color) !important;
}

.btn {
  border-radius: 8px;
  font-weight: 500;
  padding: 0.5rem 1.2rem;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.btn-success {
  background-color: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.btn-success:hover {
  background-color: #00a383;
  border-color: #00a383;
}

/* =================================
   3. Layout & Navbar
   ================================= */
.navbar {
  background-color: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  min-height: var(--navbar-height);
}

/* 모바일 메뉴가 열렸을 때 배경색 확보 */
.navbar-collapse {
  background-color: rgba(255, 255, 255, 0.95);
  padding: 1rem;
  border-radius: 0 0 12px 12px;
  margin-top: 0.5rem;
}

/* 데스크탑에서는 배경색/패딩 제거 */
@media (min-width: 992px) {
  .navbar-collapse {
    background-color: transparent;
    padding: 0;
    margin-top: 0;
  }
}

.navbar-brand {
  font-weight: 800;
  color: var(--primary-color) !important;
  font-size: 1.4rem;
}

.nav-link {
  color: var(--text-main) !important;
  font-weight: 500;
  margin-left: 10px;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--primary-color) !important;
}

.main-content {
  padding-top: calc(var(--navbar-height) + 30px) !important;
  max-width: 1200px;
  margin: 0 auto;
}

/* =================================
   4. Login Page
   ================================= */
body.login-bg {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.login-card h2 {
  color: var(--primary-color);
  font-weight: 800;
  margin-bottom: 2rem;
}

.form-control {
  border-radius: 8px;
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  background-color: #f9f9f9;
  transition: all 0.2s;
}

.form-control:focus {
  background-color: #fff;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

/* =================================
   5. Dashboard Components
   ================================= */

/* Student Chips (Horizontal Scroll) */
.student-btn-container {
  display: flex;
  overflow-x: auto;
  padding: 10px 5px 20px 5px;
  /* Bottom padding for scrollbar/shadow */
  gap: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Firefox */
}

.student-btn-container::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari */
}

.student-btn-group {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  background: white;
  border-radius: 50px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  padding: 3px;
  border: 1px solid var(--border-color);
  transition: transform 0.2s;
}

.student-btn-group:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.student-btn {
  border: none;
  background: transparent;
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 500;
}

.student-btn.active,
.student-btn-group.active .student-btn {
  background-color: var(--primary-color);
  color: white;
}

/* Penalty Student Style */
.student-btn-group.penalty {
  border-color: var(--secondary-color);
}

.student-btn-group.penalty .student-btn {
  color: var(--secondary-color);
}

.student-btn-group.penalty.active .student-btn {
  background-color: var(--secondary-color);
  color: white;
}

/* Action Button inside Chip (Phone/Info) */
.student-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f3f5;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  margin-right: 3px;
  font-size: 0.8rem;
  transition: all 0.2s;
  cursor: pointer;
}

.student-action-btn:hover {
  background: var(--info-color);
  color: white;
}

.penalty .student-action-btn:hover {
  background: var(--secondary-color);
}

/* Floor Move Button (▲ / ▼) */
.floor-move-btn {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-color);
  background: #eef2ff;
}

.floor-move-btn:hover {
  background: var(--primary-color) !important;
  color: white !important;
  transform: scale(1.1);
}

.floor-move-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Zone Cards */
.zone-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--box-shadow);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.zone-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--box-shadow-hover);
  border-color: rgba(108, 99, 255, 0.3);
}

.zone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.zone-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.zone-type-badge {
  font-size: 0.8rem;
  padding: 4px 10px;
  background-color: #eef2ff;
  color: var(--primary-color);
  border-radius: 20px;
  font-weight: 600;
}

/* Assigned Student Tag */
.assigned-list {
  min-height: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}

.assigned {
  display: inline-flex;
  align-items: center;
  background: #e3f2fd;
  color: #1565c0;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  animation: fadeIn 0.3s ease;
}

.assigned .remove {
  margin-left: 8px;
  cursor: pointer;
  color: #1565c0;
  opacity: 0.6;
  transition: opacity 0.2s;
  font-size: 1.1em;
  line-height: 1;
}

.assigned .remove:hover {
  opacity: 1;
  color: var(--secondary-color);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Inspection Area */
.inspection-area {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  margin-top: 15px;
  border: 1px solid #eee;
}

/* ─── Step Button (검사 항목 버튼) ─── */
.step-btn-row {
  margin-bottom: 7px;
}

.step-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  text-align: left;
  transition: all 0.2s ease;
  font-family: inherit;
}

/* 미완료 상태 */
.step-btn.pending {
  background: #fff;
  border-color: #dee2e6;
  color: var(--text-main);
}
.step-btn.pending:hover {
  background: #f0f4ff;
  border-color: var(--primary-color);
  transform: translateX(3px);
}

/* 저장 중 */
.step-btn.saving {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
}

/* 완료 — 검사자(inspector): 민트/초록 */
.step-btn.done-inspector {
  background: linear-gradient(135deg, #e6f9f4, #c8f0e6);
  border-color: var(--success-color);
  color: #006b56;
  cursor: default;
}

/* 완료 — 관리자(admin): 주황/황금 */
.step-btn.done-admin {
  background: linear-gradient(135deg, #fff8e6, #fdecc9);
  border-color: #e6a817;
  color: #8a5a00;
  cursor: default;
}

.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
}

.step-text {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.3;
}

.step-status {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.step-status-pending {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.step-by {
  font-weight: 400;
  opacity: 0.75;
}

.step-cancel-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  padding: 2px 5px;
  font-size: 0.85rem;
  border-radius: 4px;
  transition: all 0.15s;
  font-family: inherit;
}
.step-cancel-btn:hover {
  opacity: 1;
  background: rgba(0,0,0,0.08);
}

/* ─── 관리자: 오늘의 검사 현황 패널 ─── */
.today-zone-card {
  border-radius: 10px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 12px;
  background: #fff;
  box-shadow: var(--box-shadow);
}
.today-zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
}
.today-zone-title {
  font-weight: 700;
  font-size: 0.95rem;
}
.today-progress {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.today-step-list {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.today-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 5px 8px;
  border-radius: 7px;
}
.today-step.checked-inspector {
  background: #e6f9f4;
  color: #006b56;
}
.today-step.checked-admin {
  background: #fff8e6;
  color: #8a5a00;
}
.today-step.unchecked {
  color: var(--text-muted);
}
.today-step-num {
  font-weight: 700;
  min-width: 18px;
}
.today-step-by {
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.75;
  white-space: nowrap;
}

/* Responsive Table */
.table-responsive {
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  background: white;
  overflow: hidden;
}

.table {
  margin-bottom: 0;
}

.table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}

.table td {
  vertical-align: middle;
}