/* ui.css - Adult / Library UI System (Responsive) */

/* ===== Design Tokens ===== */
:root{
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;

  --brand: #1d4ed8;          /* 차분한 블루 */
  --brand-weak: #eff6ff;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 10px 22px rgba(17,24,39,.08);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --container: 1120px;

  --font: "Noto Sans KR", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ===== Base ===== */
html{
  /* PC에서 과도하게 커지지 않게: 15.5~17.5px 정도 */
  font-size: clamp(15.5px, 0.25vw + 15px, 17.5px);
  -webkit-text-size-adjust: 100%;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

/* 링크 기본 */
a{ color: inherit; }

/* ===== Layout ===== */
.container{
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 20px;
}

.page{
  display:none;
}
.page.active{
  display:block;
  animation: fadein .18s ease-out;
}
@keyframes fadein{
  from{ opacity:0; transform: translateY(4px); }
  to{ opacity:1; transform: translateY(0); }
}

/* 페이지 타이틀(유치한 이모지 제거용) */
.page-title{
  margin: 6px 0 16px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
}
.page-title h2{
  margin:0;
  font-size: 1.35rem;
  letter-spacing: -0.3px;
  font-weight: 600;
}
.page-title .hint{
  color: var(--muted);
  font-size: .92rem;
}

/* ===== Card ===== */
.card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

/* 카드 헤더 */
.section-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom: 10px;
}
.section-head .title{
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text);
}
.section-head .action{
  border:1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  cursor:pointer;
  font-weight: 500;
  font-size: .92rem;
}
.section-head .action:hover{
  background: #f9fafb;
}

/* ===== Inputs ===== */
input, select, textarea, button{
  font-family: var(--font);
}

.modern-input,
.input,
.input-box,
.login-input,
.select,
.search{
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  font-size: 1rem;
  outline: none;
}

.modern-input:focus,
.input:focus,
.input-box:focus,
.login-input:focus,
.select:focus,
.search:focus{
  border-color: rgba(29,78,216,.55);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}

/* ===== Buttons ===== */
.btn,
.login-btn,
.btn2{
  border:none;
  border-radius: var(--radius-md);
  cursor:pointer;
  font-weight: 600;
  font-size: 1rem;
}

.btn{
  padding: 12px 14px;
  background: var(--brand);
  color: #fff;
}

.btn:hover{ filter: brightness(.97); }

.btn:disabled{
  opacity: .55;
  cursor:not-allowed;
}

.btn-outline{
  background: #fff;
  color: var(--brand);
  border: 1px solid rgba(29,78,216,.55);
}

.btn-gray{ background: #4b5563; color:#fff; }
.btn-ok{ background: var(--success); color:#fff; }
.btn-no{ background: var(--danger); color:#fff; }
.btn-warn{ background: #f59e0b; color:#111827; }

.btn-refresh{
  border:none;
  background: transparent;
  cursor:pointer;
  color: var(--brand);
  font-weight: 600;
}

/* ===== Text helpers ===== */
.small{
  color: var(--muted);
  font-size: .92rem;
}
hr.sep{
  border:none;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

/* ===== Badges ===== */
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 600;
  white-space: nowrap;
}
.bg-ok{ background: rgba(22,163,74,.12); color: var(--success); border:1px solid rgba(22,163,74,.25); }
.bg-no{ background: rgba(220,38,38,.12); color: var(--danger); border:1px solid rgba(220,38,38,.25); }
.bg-warn{ background: rgba(217,119,6,.12); color: var(--warn); border:1px solid rgba(217,119,6,.25); }

.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 500;
  font-size: .92rem;
  cursor:pointer;
}
.pill:hover{ background:#f9fafb; }

/* ===== Lists (books) ===== */
.result-item{
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.result-item:last-child{ border-bottom:none; }

.cover-row{
  display:flex;
  gap: 12px;
  align-items:center;
  min-width: 0;
}
.cover-thumb{
  width: 52px;
  height: 74px;
  border-radius: 10px;
  object-fit: cover;
  background: #eef2f7;
  border:1px solid var(--line);
  flex: 0 0 auto;
}

.result-item b{
  font-weight: 600;
  letter-spacing: -0.2px;
}
.result-item .meta{
  color: var(--muted);
  font-size: .92rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60ch;
}

/* ===== Info box ===== */
.info{
  font-size: .95rem;
  color: var(--muted);
  line-height: 1.55;
  background: #f9fafb;
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border-left: 4px solid rgba(29,78,216,.55);
}

/* ===== Toast stays in common.js ===== */

/* ===== Navbar (Mobile bottom, Desktop top) ===== */
.navbar{
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(246,247,249,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display:flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  margin: 0 0 14px;
}

.nav-item{
  flex: 1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 500;
  color: var(--muted);
  cursor:pointer;
  user-select:none;
  border: 1px solid transparent;
}

.nav-item.active{
  background: #fff;
  color: var(--text);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

/* 모바일에서는 기존처럼 하단 고정 */
@media (max-width: 860px){
  .navbar{
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--line);
    border-bottom: none;
  }
  body{ padding-bottom: 86px; }
  .container{ padding-bottom: 100px; }
}

/* ===== Desktop home grid ===== */
.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 980px){
  .grid-2{ grid-template-columns: 1fr; }
}

/* ===== Back button ===== */
.back-btn{
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1100;
  text-decoration:none;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
}

/* ===== Staff/Admin common ===== */
.grid-menu{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.menu-card{
  display:block;
  text-decoration:none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.menu-card:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.menu-card .icon{ font-size: 36px; }
.menu-card .title{ font-size: 1.1rem; font-weight: 600; margin-top: 8px; }
.menu-card .desc{ margin-top: 6px; color: var(--muted); font-size: .95rem; }

.admin-card{
  border-color: rgba(29,78,216,.25);
  background: linear-gradient(180deg, #fff, var(--brand-weak));
}

/* ===== Loader ===== */
.loader{
  border:2px solid rgba(0,0,0,.08);
  border-top:2px solid rgba(29,78,216,.7);
  border-radius:50%;
  width: 14px;
  height: 14px;
  animation: spin 1s linear infinite;
  display:inline-block;
  vertical-align:middle;
  margin-right:6px;
}
@keyframes spin{ 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }

/* ===== Camera frame / sign pad ===== */
.camera-frame,
.cam-box{
  background: #111827;
  border-radius: var(--radius-md);
  overflow:hidden;
  height: clamp(220px, 30vh, 340px);
  display:flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(0,0,0,.08);
}
video,img{ width:100%; height:100%; object-fit:cover; }

.sign-pad{
  width:100%;
  height: 160px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(107,114,128,.6);
  background: #f9fafb;
}
