/* admin.css — 관리자 패널 스타일 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Noto Sans KR', sans-serif;
  background: #0f1117; color: #e2e8f0; min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }

:root {
  --bg:      #0f1117;
  --bg2:     #171b26;
  --bg3:     #1e2433;
  --border:  rgba(255,255,255,0.08);
  --gold:    #f59e0b;
  --teal:    #0e7490;
  --teal-lt: #22d3ee;
  --red:     #ef4444;
  --green:   #10b981;
  --text:    #e2e8f0;
  --dim:     #94a3b8;
  --radius:  12px;
  --tr:      0.2s ease;
  --sidebar: 240px;
}

/* ===== LOGIN ===== */
#loginScreen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1117 0%, #1e2433 100%);
}
.login-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 20px; padding: 48px 40px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo span { font-size: 3rem; display: block; margin-bottom: 8px; }
.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--gold); margin-bottom: 6px; }
.login-logo p { color: var(--dim); font-size: 0.85rem; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.8rem; color: var(--dim); margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 14px; color: var(--text); font-size: 0.9rem;
  transition: var(--tr); outline: none;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14,116,144,0.2);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.login-error { color: var(--red); font-size: 0.82rem; margin-bottom: 12px; min-height: 18px; }
.btn-login {
  width: 100%; padding: 13px; background: linear-gradient(135deg, var(--teal), #0891b2);
  color: #fff; border-radius: 8px; font-size: 0.95rem; font-weight: 600;
  transition: var(--tr);
}
.btn-login:hover { opacity: 0.9; transform: translateY(-1px); }

/* ===== ADMIN LAYOUT ===== */
#adminPanel { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar); background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; transition: transform var(--tr);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 12px; padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo span { font-size: 1.8rem; }
.sidebar-logo strong { display: block; font-size: 0.9rem; color: var(--gold); }
.sidebar-logo small { display: block; font-size: 0.7rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: var(--dim); font-size: 0.875rem; transition: var(--tr);
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(14,116,144,0.2); color: var(--teal-lt); }
.nav-item span { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.view-site-btn {
  display: block; text-align: center; padding: 9px; background: var(--bg3);
  border-radius: 8px; font-size: 0.82rem; color: var(--dim); transition: var(--tr);
}
.view-site-btn:hover { color: var(--gold); }
.logout-btn {
  padding: 9px; border-radius: 8px; background: rgba(239,68,68,0.1);
  color: var(--red); font-size: 0.82rem; font-weight: 600; transition: var(--tr);
}
.logout-btn:hover { background: rgba(239,68,68,0.2); }

/* MAIN */
.admin-main {
  margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}
.admin-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15,17,23,0.9); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 14px 28px;
}
.sidebar-toggle { display: none; font-size: 1.2rem; background: none; color: var(--text); padding: 4px; }
.admin-page-title { font-size: 1rem; font-weight: 600; flex: 1; }
.header-time { color: var(--dim); font-size: 0.82rem; }

/* PANEL */
.panel { display: none; padding: 28px; flex: 1; }
.panel.active { display: block; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.panel-header h3 { font-size: 1.1rem; font-weight: 700; }
.panel-note { color: var(--dim); font-size: 0.85rem; margin-bottom: 20px; }
.btn-add {
  padding: 9px 20px; background: linear-gradient(135deg, var(--teal), #0891b2);
  color: #fff; border-radius: 8px; font-size: 0.85rem; font-weight: 600; transition: var(--tr);
}
.btn-add:hover { opacity: 0.9; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: center; gap: 16px;
}
.stat-icon { font-size: 2rem; }
.stat-card strong { display: block; font-size: 1.6rem; font-weight: 700; color: var(--gold); }
.stat-card small { font-size: 0.8rem; color: var(--dim); }

.dash-info { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.dash-info h3 { margin-bottom: 16px; font-size: 1rem; }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.quick-btn {
  padding: 10px 20px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.85rem; transition: var(--tr);
}
.quick-btn:hover { border-color: var(--teal); color: var(--teal-lt); }

/* TAB BAR */
.tab-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.atab {
  padding: 8px 18px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 50px; color: var(--dim); font-size: 0.82rem; transition: var(--tr);
}
.atab.active, .atab:hover {
  background: linear-gradient(135deg, var(--teal), #0891b2); color: #fff; border-color: transparent;
}

/* ADMIN LIST */
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; display: flex; align-items: center; gap: 16px; transition: var(--tr);
}
.list-item:hover { border-color: rgba(14,116,144,0.4); }
.list-item-img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--bg3); }
.list-item-icon {
  width: 56px; height: 56px; border-radius: 8px; flex-shrink: 0;
  background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.list-item-info { flex: 1; }
.list-item-info strong { display: block; font-size: 0.95rem; margin-bottom: 3px; }
.list-item-info span { font-size: 0.82rem; color: var(--dim); }
.list-item-price { color: var(--gold); font-weight: 700; font-size: 0.9rem; white-space: nowrap; margin-right: 8px; }
.item-actions { display: flex; gap: 8px; }
.btn-edit, .btn-del {
  padding: 6px 14px; border-radius: 6px; font-size: 0.78rem; font-weight: 600; transition: var(--tr);
}
.btn-edit { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-edit:hover { border-color: var(--teal); color: var(--teal-lt); }
.btn-del { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-del:hover { background: rgba(239,68,68,0.2); }

/* GALLERY ADMIN */
.gallery-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px; }
.gallery-admin-item { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--bg3); }
.gallery-admin-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-admin-item-actions {
  position: absolute; inset: 0; background: rgba(0,0,0,0.6);
  display: none; align-items: center; justify-content: center; gap: 8px;
}
.gallery-admin-item:hover .gallery-admin-item-actions { display: flex; }
.gallery-admin-item-actions .btn-edit,
.gallery-admin-item-actions .btn-del { padding: 5px 9px; font-size: 0.72rem; }

/* 파일 업로드 드래그앤드롭 */
.file-upload-area.drag-over { border-color: var(--teal); background: rgba(14,116,144,0.08); }

/* SETTINGS FORM */
.settings-form { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn-save {
  margin-top: 20px; padding: 12px 32px;
  background: linear-gradient(135deg, var(--green), #059669);
  color: #fff; border-radius: 8px; font-size: 0.9rem; font-weight: 700; transition: var(--tr);
}
.btn-save:hover { opacity: 0.9; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 540px; box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%; background: var(--bg3);
  color: var(--text); font-size: 0.9rem; display: flex; align-items: center; justify-content: center;
  transition: var(--tr);
}
.modal-close:hover { background: rgba(239,68,68,0.2); color: var(--red); }
.modal-body { padding: 24px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.btn-cancel { padding: 10px 20px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.85rem; }
.btn-confirm { padding: 10px 24px; background: linear-gradient(135deg, var(--teal), #0891b2); color: #fff; border-radius: 8px; font-size: 0.85rem; font-weight: 600; }

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: var(--bg2); border: 1px solid var(--green); border-radius: 10px;
  padding: 12px 20px; font-size: 0.875rem; font-weight: 500;
  transform: translateY(80px); opacity: 0; transition: 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: var(--red); color: var(--red); }

/* FILE UPLOAD */
.file-upload-area {
  border: 2px dashed var(--border); border-radius: 10px; padding: 32px;
  text-align: center; cursor: pointer; transition: var(--tr); background: var(--bg3);
}
.file-upload-area:hover { border-color: var(--teal); }
.file-upload-area input { display: none; }
.file-upload-area p { color: var(--dim); font-size: 0.85rem; margin-top: 8px; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
}
