/* ==========================================
   스마트 QR 출석인증 시스템 - 글로벌 디자인 시스템
   ========================================== */

:root {
  /* Primary Colors (Fresh Light Green & Jade Lime) */
  --primary: #16a34a;
  --primary-hover: #15803d;
  --primary-light: #dcfce7;
  --primary-gradient: linear-gradient(135deg, #16a34a 0%, #22c55e 50%, #10b981 100%);
  
  /* Status Colors */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;
  --info-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  
  /* Neutral Dark / Light */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #4ade80;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  /* Shadows & Glassmorphism */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 25px rgba(22, 163, 74, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  --font-family: 'Noto Sans KR', 'Noto Sans JP', 'Noto Sans SC', 'Noto Sans TC', 'Noto Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 중국어 전용 폰트 우선 매핑 (간체자/번체자 완벽 대응) */
.font-zh, [lang="zh"], .lang-zh {
  font-family: 'Noto Sans SC', 'Noto Sans TC', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans', sans-serif !important;
}

/* 다크 모드 */
[data-theme="dark"] {
  --bg-main: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-subtle: #1e293b;
  --border-color: #27354f;
  --border-focus: #22c55e;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
  --shadow-glow: 0 0 30px rgba(34, 197, 94, 0.3);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .app-header {
  background-color: rgba(19, 27, 46, 0.9);
}

.header-content {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  margin-left: 0.4rem;
}

[data-theme="dark"] .brand-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

/* Nav Tabs */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
  padding: 0.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .nav-btn.active {
  background: #1e293b;
  color: #818cf8;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.api-status-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.status-dot.demo {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

/* Main Content Area */
.app-main {
  flex: 1;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Card Common */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.glass-card:hover {
  box-shadow: var(--shadow-md);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  word-break: keep-all;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.45);
  filter: brightness(1.05);
}

.btn-success {
  background: var(--success-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  filter: brightness(1.05);
}

.btn-warning {
  background: var(--warning-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-secondary {
  background: var(--bg-card-subtle);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--border-color);
}

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

.btn-outline-primary:hover {
  background: var(--primary-light);
}

[data-theme="dark"] .btn-outline-primary:hover {
  background: rgba(99, 102, 241, 0.15);
}

.btn-lg {
  padding: 0.9rem 1.75rem;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-inperson {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.badge-online {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.badge-substitute {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.badge-absent {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

[data-theme="dark"] .badge-inperson {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .badge-online {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
  border-color: rgba(2, 132, 199, 0.3);
}

[data-theme="dark"] .badge-substitute {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .badge-absent {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border-color: rgba(100, 116, 139, 0.3);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  min-width: 280px;
  max-width: 420px;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  font-size: 0.92rem;
  font-weight: 500;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

.toast.info {
  border-left: 4px solid var(--info);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 900px) {
  .header-content {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .header-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }
  .nav-btn {
    white-space: nowrap;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  .app-main {
    padding: 1rem 0.75rem 2.5rem;
  }
  .section-title {
    font-size: 1.15rem;
  }
}
