/* ===== 정성그린 관리자 패널 스타일 ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
  --sb-w: 220px;
  --bg: #f0f2f5;
  --sb-bg: #1a2e1a;
  --sb-hover: #2e4d2e;
  --sb-active: #2e7d32;
  --header-bg: #fff;
  --primary: #2e7d32;
  --primary-d: #1b5e20;
  --accent: #8bc34a;
  --danger: #e53935;
  --warn: #f57f17;
  --text: #222;
  --text-m: #555;
  --text-l: #888;
  --border: #e0e0e0;
  --card-bg: #fff;
  --shadow: 0 1px 6px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans KR', '맑은 고딕', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
input, textarea, select { font-family: inherit; }

/* ── SIDEBAR ───────────────────────────────────────── */
#sidebar {
  width: var(--sb-w);
  background: var(--sb-bg);
  color: #c8e6c9;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s;
}
.sb-brand {
  padding: 20px 18px;
  border-bottom: 1px solid #2d4a2d;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background .15s;
}
a.sb-brand:hover { background: #2d4a2d; }
.sb-brand .sb-logo {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; font-weight: 700;
  flex-shrink: 0;
}
.sb-brand .sb-title { font-size: 13px; font-weight: 700; color: #fff; line-height: 1.3; }
.sb-brand .sb-sub   { font-size: 10px; color: #6a9a6a; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #4d7a4d;
  padding: 12px 18px 4px;
  text-transform: uppercase;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: #9fc99f;
  font-size: 13px;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a .ni { font-size: 16px; line-height: 1; width: 20px; text-align: center; }
.sidebar-nav a:hover { background: var(--sb-hover); color: #fff; }
.sidebar-nav a.active {
  background: rgba(46,125,50,.3);
  color: #fff;
  border-left-color: var(--accent);
  font-weight: 600;
}
.sb-footer {
  padding: 14px 18px;
  border-top: 1px solid #2d4a2d;
  font-size: 11px;
  color: #4d7a4d;
}

/* ── MAIN AREA ─────────────────────────────────────── */
#main-wrap {
  margin-left: var(--sb-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOP BAR ───────────────────────────────────────── */
#topbar {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
#sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--text-m);
}
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-m);
}
.breadcrumb span { color: var(--text-l); }
.breadcrumb strong { color: var(--text); }

.topbar-right {
  display: flex; align-items: center; gap: 12px;
}
.admin-badge {
  font-size: 12px; color: var(--text-m);
  display: flex; align-items: center; gap: 6px;
}
.admin-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}
#btn-logout {
  padding: 6px 14px; border-radius: 4px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-m); font-size: 12px; cursor: pointer;
  transition: all .2s;
}
#btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ── CONTENT ────────────────────────────────────────── */
#content { padding: 28px; flex: 1; }
.page-title {
  font-size: 22px; font-weight: 700; color: var(--text);
  margin-bottom: 6px;
}
.page-desc { font-size: 13px; color: var(--text-l); margin-bottom: 24px; }

/* ── STAT CARDS ─────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border);
}
.stat-card .sc-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.sc-green  { background: #e8f5e9; }
.sc-blue   { background: #e3f2fd; }
.sc-orange { background: #fff3e0; }
.sc-purple { background: #f3e5f5; }
.stat-card .sc-num {
  font-size: 28px; font-weight: 700; color: var(--text); line-height: 1;
}
.stat-card .sc-label { font-size: 12px; color: var(--text-l); margin-top: 2px; }

/* ── CARD ────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .card-head-actions { display: flex; gap: 8px; }
.card-body { padding: 20px 22px; }

/* ── TABLE ───────────────────────────────────────────── */
.adm-table { width: 100%; border-collapse: collapse; }
.adm-table th {
  background: #f8f9fa; border-bottom: 2px solid var(--border);
  padding: 10px 14px; font-size: 12px; font-weight: 600;
  text-align: left; color: var(--text-m);
  white-space: nowrap;
}
.adm-table td {
  padding: 11px 14px; border-bottom: 1px solid #f0f0f0;
  font-size: 13px; color: var(--text); vertical-align: middle;
}
.adm-table tr:hover td { background: #fafafa; }
.adm-table .col-center { text-align: center; }
.adm-table .col-date   { white-space: nowrap; color: var(--text-l); }
.adm-table .title-cell { max-width: 340px; }
.adm-table .title-cell a { color: var(--primary); font-weight: 500; }

.badge-imp {
  display: inline-block; background: #fff3e0;
  color: var(--warn); font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; margin-left: 6px;
}
.badge-new {
  display: inline-block; background: #e8f5e9;
  color: var(--primary); font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; margin-left: 6px;
}

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 16px; border-radius: 5px; font-size: 13px;
  font-weight: 500; cursor: pointer; border: none; transition: all .15s;
  font-family: inherit;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text-m); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c62828; }
.btn-warn   { background: #fff8e1; border: 1px solid #ffe082; color: var(--warn); }
.btn-warn:hover { background: #fff3cd; }
.btn-success { background: var(--primary); color: #fff; }
.btn-group { display: flex; gap: 6px; }

/* ── FORM ────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 14px; }
.form-group.full { grid-column: 1 / -1; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-m); margin-bottom: 5px;
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 5px;
  font-size: 13px; color: var(--text);
  background: #fff; transition: border-color .2s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { width: auto; cursor: pointer; }
.form-check label { font-size: 13px; cursor: pointer; }

.form-hint { font-size: 11px; color: var(--text-l); margin-top: 4px; }
.divider-line { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── ALERT / TOAST ───────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 6px; font-size: 13px;
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-danger  { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.alert-info    { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }

#toast {
  position: fixed; bottom: 28px; right: 28px;
  background: #323232; color: #fff;
  padding: 12px 20px; border-radius: 6px; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  opacity: 0; transform: translateY(12px);
  transition: all .3s; z-index: 9999;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.toast-success { background: var(--primary); }
#toast.toast-error   { background: var(--danger); }

/* ── MODAL ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 500;
  display: none; align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 10px;
  padding: 28px; width: 560px; max-width: 96vw;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.modal-title {
  font-size: 17px; font-weight: 700;
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── PAGINATION ──────────────────────────────────────── */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 16px; }
.pagination button {
  width: 32px; height: 32px; border-radius: 5px;
  border: 1px solid var(--border); background: #fff;
  font-size: 12px; cursor: pointer; transition: all .15s;
  font-family: inherit;
}
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* ── LOGIN PAGE ──────────────────────────────────────── */
body.login-page {
  background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 60%, #4caf50 100%);
  display: flex; align-items: center; justify-content: center;
  margin-left: 0;
}
.login-box {
  background: #fff; border-radius: 14px;
  padding: 44px 40px; width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo .lg-icon {
  width: 64px; height: 64px; background: var(--primary);
  border-radius: 16px; display: flex; align-items: center;
  justify-content: center; font-size: 32px; color: #fff;
  margin: 0 auto 12px;
}
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.login-logo p  { font-size: 12px; color: var(--text-l); margin-top: 3px; }
.login-form .form-group { margin-bottom: 14px; }
.login-form .form-label { font-size: 12px; font-weight: 600; color: var(--text-m); margin-bottom: 6px; display: block; }
.login-form .form-control { padding: 11px 14px; }
.login-btn {
  width: 100%; padding: 13px; background: var(--primary);
  color: #fff; border: none; border-radius: 6px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: background .2s; margin-top: 4px;
}
.login-btn:hover { background: var(--primary-d); }
.login-error {
  background: #ffebee; color: #c62828;
  border: 1px solid #ef9a9a; border-radius: 5px;
  padding: 10px 14px; font-size: 13px;
  margin-bottom: 12px; display: none;
}
.login-hint {
  text-align: center; font-size: 11px; color: var(--text-l); margin-top: 16px;
}

/* ── GALLERY GRID (admin) ────────────────────────────── */
.gallery-admin-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.gallery-admin-item {
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; background: #fafafa;
}
.gallery-admin-item .gi-thumb {
  height: 120px; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-l);
  overflow: hidden;
}
.gallery-admin-item .gi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-admin-item .gi-info { padding: 10px 12px; }
.gallery-admin-item .gi-info strong { font-size: 12px; display: block; margin-bottom: 4px; }
.gallery-admin-item .gi-info .gi-date { font-size: 11px; color: var(--text-l); }
.gallery-admin-item .gi-actions { padding: 8px 12px; border-top: 1px solid var(--border); display: flex; gap: 6px; }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-admin-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open { transform: translateX(0); }
  #main-wrap { margin-left: 0; }
  #sidebar-toggle { display: block; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .gallery-admin-grid { grid-template-columns: repeat(2, 1fr); }
  #content { padding: 16px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-box { padding: 28px 20px; }
}

/* ===== 갤러리 업로드 미리보기/빈 썸네일 ===== */
.img-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.gi-thumb-empty {
  padding: 20px;
  text-align: center;
  color: #bbb;
  font-size: 12px;
}
