/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
input { -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; }
img { -webkit-user-drag: none; -khtml-user-drag: none; -moz-user-drag: none; -o-user-drag: none; user-drag: none; pointer-events: auto; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #1a1a2e; background: #f8f9fb; line-height: 1.7; }

/* ===== Login Screen ===== */
#login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
#login-overlay.hidden { display: none; }
.login-card {
  background: #fff; border-radius: 20px; padding: 3rem 2.5rem;
  width: 90%; max-width: 400px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card .logo { font-size: 3rem; margin-bottom: .5rem; }
.login-card h1 { font-size: 1.4rem; font-weight: 700; color: #1a1a2e; margin-bottom: .3rem; }
.login-card p { font-size: .85rem; color: #888; margin-bottom: 2rem; }
.login-card .quiz-question {
  font-size: 1.1rem; font-weight: 700; color: #0f3460;
  margin-bottom: 1rem; padding: .6rem 1rem;
  background: #f0f4ff; border-radius: 8px;
}
.login-card input {
  width: 100%; padding: .85rem 1rem; border: 2px solid #e0e0e0; border-radius: 10px;
  font-size: 1rem; text-align: center; transition: border-color .2s;
  font-family: inherit;
}
.login-card input:focus { outline: none; border-color: #0f3460; }
.login-card button {
  width: 100%; padding: .85rem; margin-top: 1rem;
  background: #0f3460; color: #fff; border: none; border-radius: 10px;
  font-size: 1rem; font-weight: 600; cursor: pointer; transition: background .2s;
  font-family: inherit;
}
.login-card button:hover { background: #1a1a2e; }
.login-error { color: #e74c3c; font-size: .85rem; margin-top: .5rem; display: none; }

/* ===== App Layout ===== */
#app { display: none; min-height: 100vh; }
#app.active { display: flex; }

/* ===== Header ===== */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px; background: #fff; border-bottom: 1px solid #e8e8e8;
  display: flex; align-items: center; padding: 0 1.2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
header .menu-toggle {
  font-size: 1.3rem; cursor: pointer; margin-right: 1rem;
  color: #555; display: none; user-select: none;
}
header h1 { font-size: 1rem; font-weight: 700; color: #1a1a2e; white-space: nowrap; }
header .spacer { flex: 1; }
header .user-info { font-size: .8rem; color: #666; margin-right: .8rem; }
header .user-info strong { color: #0f3460; }
header .btn-logout {
  padding: .35rem .8rem; font-size: .75rem; background: none;
  border: 1px solid #ddd; border-radius: 6px; cursor: pointer;
  color: #666; font-family: inherit; transition: all .2s;
}
header .btn-logout:hover { border-color: #e74c3c; color: #e74c3c; }

/* ===== Sidebar ===== */
#sidebar {
  position: fixed; top: 56px; left: 0; bottom: 0; width: 270px;
  background: #fff; border-right: 1px solid #e8e8e8; overflow-y: auto;
  padding: 1rem 0; z-index: 50; transition: transform .3s ease;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }
#sidebar ul { list-style: none; }
#sidebar > ul > li { margin-bottom: 2px; }
.nav-item {
  display: flex; align-items: center; padding: .55rem 1.2rem;
  cursor: pointer; font-size: .88rem; color: #444; transition: all .15s;
  border-left: 3px solid transparent; user-select: none;
}
.nav-item:hover { background: #f0f4ff; color: #0f3460; }
.nav-item.active { background: #e8efff; color: #0f3460; font-weight: 600; border-left-color: #0f3460; }
.nav-item .icon { margin-right: .6rem; font-size: 1rem; width: 1.2rem; text-align: center; }
.nav-item .arrow { margin-left: auto; font-size: .7rem; transition: transform .2s; color: #aaa; }
.nav-item .arrow.open { transform: rotate(90deg); }
.nav-children { display: none; }
.nav-children.open { display: block; }
.nav-children .nav-item { padding-left: 2.8rem; font-size: .83rem; }
.nav-children .nav-children .nav-item { padding-left: 3.8rem; font-size: .8rem; }

/* ===== Main Content ===== */
main {
  margin-left: 270px; margin-top: 56px; padding: 2rem 2.5rem;
  max-width: 920px; min-height: calc(100vh - 56px);
}
.section { display: none; }
.section.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== Content Typography ===== */
.section h2 { font-size: 1.6rem; font-weight: 800; color: #1a1a2e; margin-bottom: .3rem; border-bottom: 3px solid #0f3460; padding-bottom: .5rem; }
.section h3 { font-size: 1.2rem; font-weight: 700; color: #16213e; margin-top: 2rem; margin-bottom: .5rem; }
.section h4 { font-size: 1.05rem; font-weight: 600; color: #333; margin-top: 1.5rem; margin-bottom: .4rem; }
.section h5 { font-size: .95rem; font-weight: 600; color: #555; margin-top: 1.2rem; margin-bottom: .3rem; }
.section p { margin-bottom: .8rem; }
.section ul, .section ol { margin: .5rem 0 1rem 1.5rem; }
.section li { margin-bottom: .3rem; }
.section li li { margin-bottom: .15rem; }
.section strong { color: #c0392b; }
.section em { color: #0f3460; font-style: normal; font-weight: 600; }

/* ===== Special Blocks ===== */
.warning-box {
  background: #fff3f3; border-left: 4px solid #e74c3c; padding: .8rem 1rem;
  margin: 1rem 0; border-radius: 0 8px 8px 0; font-size: .9rem;
}
.warning-box::before { content: ''; font-weight: 700; }
.info-box {
  background: #eef6ff; border-left: 4px solid #3498db; padding: .8rem 1rem;
  margin: 1rem 0; border-radius: 0 8px 8px 0; font-size: .9rem;
}
.tip-box {
  background: #f0fff4; border-left: 4px solid #27ae60; padding: .8rem 1rem;
  margin: 1rem 0; border-radius: 0 8px 8px 0; font-size: .9rem;
}
.highlight-box {
  background: #fffde7; border-left: 4px solid #f1c40f; padding: .8rem 1rem;
  margin: 1rem 0; border-radius: 0 8px 8px 0; font-size: .9rem;
}
.param-box {
  background: #f8f8fc; border: 1px solid #e0e0e8; padding: 1rem;
  margin: 1rem 0; border-radius: 8px; font-family: 'Consolas', monospace; font-size: .88rem;
}

/* ===== Tables ===== */
table {
  width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .88rem;
  background: #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
thead { background: #1a1a2e; color: #fff; }
th { padding: .65rem .8rem; text-align: left; font-weight: 600; font-size: .82rem; }
td { padding: .6rem .8rem; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
tbody tr:hover { background: #f8f9ff; }
td strong { color: #c0392b; }

/* ===== Images ===== */
.img-container {
  margin: 1.2rem 0; border-radius: 10px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.1); background: #fff;
}
.img-container img {
  width: 100%; height: auto; display: block; cursor: pointer;
  transition: transform .2s;
}
.img-container img:hover { transform: scale(1.01); }
.img-caption {
  padding: .5rem .8rem; font-size: .78rem; color: #888;
  background: #fafafa; border-top: 1px solid #eee; text-align: center;
}

/* Image lightbox */
#lightbox {
  display: none; position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.85); align-items: center; justify-content: center;
  cursor: zoom-out;
}
#lightbox.show { display: flex; }
#lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }

/* ===== Dose Table (보톡스 etc) ===== */
.dose-card {
  background: #fff; border: 1px solid #e0e0e8; border-radius: 10px;
  padding: 1rem 1.2rem; margin: .8rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.dose-card h5 {
  font-size: .95rem; color: #0f3460; margin: 0 0 .4rem 0;
  display: flex; align-items: center; gap: .4rem;
}
.dose-card .dose { font-weight: 700; color: #e74c3c; }
.dose-card .method { font-size: .82rem; color: #666; background: #f0f4ff; padding: .15rem .5rem; border-radius: 4px; display: inline-block; margin-bottom: .4rem; }

/* ===== Home Screen ===== */
.home-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem; margin-top: 1.5rem;
}
.home-card {
  background: #fff; border-radius: 12px; padding: 1.2rem;
  text-align: center; cursor: pointer; transition: all .2s;
  box-shadow: 0 2px 6px rgba(0,0,0,.06); border: 1px solid #eee;
}
.home-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.1); border-color: #0f3460; }
.home-card .card-icon { font-size: 2rem; margin-bottom: .5rem; }
.home-card .card-title { font-weight: 700; color: #1a1a2e; font-size: .95rem; }
.home-card .card-desc { font-size: .78rem; color: #888; margin-top: .3rem; }

.home-principles {
  background: #fff; border-radius: 12px; padding: 1.5rem;
  margin-top: 1.5rem; border: 1px solid #eee;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.home-principles h3 { margin-top: 0; }

/* ===== Divider ===== */
hr { border: none; border-top: 1px solid #eee; margin: 2rem 0; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  header .menu-toggle { display: block; }
  #sidebar { transform: translateX(-100%); width: 280px; box-shadow: 4px 0 16px rgba(0,0,0,.1); }
  #sidebar.open { transform: translateX(0); }
  main { margin-left: 0; padding: 1.5rem 1rem; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  table { font-size: .8rem; }
  th, td { padding: .4rem .5rem; }
}

@media (max-width: 480px) {
  .login-card { padding: 2rem 1.5rem; }
  .section h2 { font-size: 1.3rem; }
  .home-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== Print ===== */
@media print {
  header, #sidebar, #login-overlay { display: none !important; }
  main { margin: 0; padding: 1rem; }
  .section { display: block !important; page-break-inside: avoid; }
}
