/* ── 기본 변수 ── */
:root {
  --primary: #5B6CF9;
  --primary-light: #EEF0FF;
  --primary-dark: #3D4ED6;
  --accent: #FF6B6B;
  --bg: #F7F8FC;
  --surface: #FFFFFF;
  --border: #E8EAEF;
  --text: #1A1D2B;
  --text-sub: #6B7280;
  --text-muted: #9CA3AF;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 16px rgba(91,108,249,0.08);
  --shadow-hover: 0 8px 32px rgba(91,108,249,0.18);
  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

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

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── 헤더 ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; cursor: default; text-decoration: none; }
.logo-img { height: 40px; width: auto; object-fit: contain; }
.logo-texts { display: flex; flex-direction: column; gap: 0; }
.logo-text { font-size: 1.1rem; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; line-height: 1.2; }
.logo-sub { font-size: 0.65rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0.3px; line-height: 1; }
.header-right { display: flex; align-items: center; gap: 12px; }

.admin-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--primary-light);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}
.admin-badge .dot {
  width: 7px; height: 7px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50% { opacity:0.6; transform:scale(1.3); }
}

.btn-admin {
  padding: 8px 18px;
  border-radius: 20px;
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-admin:hover { background: var(--primary); color: #fff; }
.btn-logout { border-color: var(--accent); color: var(--accent); }
.btn-logout:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── 히어로 ── */
.hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  justify-content: center;
}
.hero-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-title {
  font-size: clamp(1rem, 2.2vw, 1.4rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

/* 검색 */
.search-wrap {
  position: relative;
  width: 380px;
  flex-shrink: 0;
}
.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 16px 48px 16px 50px;
  border-radius: 50px;
  border: none;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  outline: none;
  transition: var(--transition);
  color: var(--text);
}
.search-input:focus { box-shadow: 0 8px 40px rgba(91,108,249,0.35); }
.search-input::placeholder { color: var(--text-muted); }
.search-clear {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px; height: 22px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── 메인 ── */
.main { flex: 1; padding: 2rem 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }

/* 탭바 */
.tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 12px;
}
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  padding: 8px 18px;
  border-radius: 20px;
  border: none;
  background: var(--surface);
  color: var(--text-sub);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
  font-family: inherit;
}
.tab:hover { background: var(--primary-light); color: var(--primary); }
.tab.active { background: var(--primary); color: #fff; box-shadow: 0 4px 16px rgba(91,108,249,0.4); }

/* 관리자 버튼 */
.admin-actions { display: flex; gap: 8px; }
.btn-add {
  padding: 8px 18px;
  border-radius: 20px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-add:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-manage {
  padding: 8px 18px;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-manage:hover { border-color: var(--primary); color: var(--primary); }

/* 카드 그리드 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid var(--border);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}
.card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.card-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-light), #dde0ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}
.card-badge {
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
}
.card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.card-desc {
  font-size: 0.875rem;
  color: var(--text-sub);
  line-height: 1.55;
  flex: 1;
}
.card-arrow {
  align-self: flex-end;
  color: var(--primary);
  font-size: 1.1rem;
  opacity: 0;
  transition: var(--transition);
}
.card:hover .card-arrow { opacity: 1; transform: translateX(3px); }

/* 관리자 카드 액션 */
.card-admin-actions {
  display: none;
  position: absolute;
  top: 10px; right: 10px;
  gap: 4px;
}
.admin-mode .card-admin-actions { display: flex; }
.card-edit-btn, .card-del-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.card-edit-btn { background: #EEF0FF; color: var(--primary); }
.card-edit-btn:hover { background: var(--primary); color: #fff; }
.card-del-btn { background: #FFF0F0; color: var(--accent); }
.card-del-btn:hover { background: var(--accent); color: #fff; }

/* 카드 하단 행 (매뉴얼 버튼 + 화살표) */
.card-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.card-manual-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #EEF6EE;
  color: #16a34a;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #bbf7d0;
  transition: var(--transition);
}
.card-manual-btn:hover { background: #16a34a; color: #fff; border-color: #16a34a; }

/* 관리자 테이블 매뉴얼 관련 */
.manual-tag {
  display: inline-block;
  font-size: 0.78rem;
  color: #16a34a;
  font-weight: 500;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.manual-upload-label {
  cursor: pointer;
  user-select: none;
}

/* 빈 상태 */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; display: block; margin-bottom: 1rem; }

/* ── 모달 ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10,10,30,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-overlay.open { display: flex; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  animation: slideUp 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-wide { max-width: 720px; }
@keyframes slideUp { from { transform: translateY(30px); opacity:0; } to { transform: translateY(0); opacity:1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.5rem 1.75rem 0;
}
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--accent); color: #fff; }
.modal-body { padding: 1.5rem 1.75rem; }
.modal-footer {
  padding: 0 1.75rem 1.5rem;
  display: flex; justify-content: flex-end; gap: 8px;
}

/* 폼 */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; }
.form-row { display: flex; gap: 12px; }
.form-group label { font-size: 0.875rem; font-weight: 600; color: var(--text-sub); }
.req { color: var(--accent); }
.form-group input, .form-group textarea, .form-group select {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  color: var(--text);
  background: var(--bg);
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); background: #fff; }
.form-group textarea { resize: vertical; }
.form-error { color: var(--accent); font-size: 0.82rem; min-height: 1.2rem; margin-top: 2px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem; }
.checkbox-label input { width: auto; }

.btn-primary {
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-cancel {
  padding: 10px 24px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-sub);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-cancel:hover { background: var(--bg); }

/* 패널 탭 */
.panel-tabs { display: flex; gap: 4px; margin-bottom: 1.25rem; }
.panel-tab {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  color: var(--text-sub);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.panel-tab.active { background: var(--primary); color: #fff; }

/* 관리자 테이블 */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text-sub);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-table tr:hover td { background: var(--bg); }

.btn-table-edit {
  padding: 4px 12px; border-radius: 6px;
  border: none; background: var(--primary-light); color: var(--primary);
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: var(--transition);
}
.btn-table-edit:hover { background: var(--primary); color: #fff; }
.btn-table-del {
  padding: 4px 12px; border-radius: 6px;
  border: none; background: #FFF0F0; color: var(--accent);
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: var(--transition);
}
.btn-table-del:hover { background: var(--accent); color: #fff; }

/* ── 푸터 ── */
.footer {
  background: #2c3a4a;
  border-top: 3px solid #1a6b3c;
  padding: 1.25rem 2rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.footer-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}
.footer-logo-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.footer-org-kr {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}
.footer-org-en {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.2px;
}
.footer-info {
  text-align: right;
}
.footer-address {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  margin-bottom: 3px;
}
.footer-copy {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}

/* ── 로고 업로드 섹션 ── */
.logo-upload-section {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.logo-preview-wrap {
  flex: 0 0 200px;
  text-align: center;
}
.logo-preview-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.logo-preview-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
}
.logo-preview-img {
  max-height: 60px;
  max-width: 160px;
  object-fit: contain;
}
.logo-preview-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.logo-upload-controls { flex: 1; min-width: 240px; }
.logo-drop-zone {
  border: 2px dashed var(--primary);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--primary-light);
  transition: var(--transition);
}
.logo-drop-zone:hover { background: #dde0ff; }
.logo-drop-icon { font-size: 1.8rem; display: block; margin-bottom: 0.5rem; }
.logo-drop-text { font-size: 0.9rem; font-weight: 600; color: var(--primary); margin-bottom: 0.25rem; }
.logo-drop-sub { font-size: 0.75rem; color: var(--text-muted); }

/* ── 반응형 ── */
@media (max-width: 640px) {
  .header-inner { padding: 0 1rem; }
  .hero { padding: 2.5rem 1rem 2rem; }
  .container { padding: 0 1rem; }
  .card-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .tab-bar { flex-direction: column; align-items: flex-start; }
}
