@font-face {
  font-family: 'Pretendard Variable';
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url('./fonts/PretendardVariable.woff2') format('woff2-variations');
}

/* ===================================
   CMS ADMIN STYLES
   Reusable across templates
=================================== */

:root {
  --admin-primary: #2563eb;
  --admin-primary-dark: #1d4ed8;
  --admin-bg: #f1f5f9;
  --admin-white: #ffffff;
  --admin-text: #1e293b;
  --admin-text-light: #64748b;
  --admin-border: #e2e8f0;
  --admin-success: #22c55e;
  --admin-danger: #ef4444;
  --admin-warning: #f59e0b;
  --admin-sidebar-width: 250px;
  --admin-radius: 12px;
}

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

body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--admin-text);
  background: var(--admin-bg);
}

a { text-decoration: none; color: inherit; }

/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--admin-bg);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-box {
  background: var(--admin-white);
  padding: 40px 32px;
  border-radius: var(--admin-radius);
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 28px;
  color: var(--admin-text);
}

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 20px;
}

.alert-error {
  background: #fef2f2;
  color: var(--admin-danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--admin-text);
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--admin-text);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-help {
  font-size: 0.75rem;
  color: var(--admin-text-light);
  margin-top: 4px;
}

/* ===== BUTTONS ===== */
.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--admin-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.btn-login:hover { background: var(--admin-primary-dark); }

.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary { background: var(--admin-primary); color: #fff; }
.btn-primary:hover { background: var(--admin-primary-dark); }

.btn-danger { background: var(--admin-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-secondary {
  background: var(--admin-white);
  color: var(--admin-text);
  border: 1px solid var(--admin-border);
}
.btn-secondary:hover { background: var(--admin-bg); }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* ===== ADMIN LAYOUT ===== */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--admin-sidebar-width);
  background: var(--admin-text);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.badge {
  margin-left: auto;
  background: var(--admin-danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-logout {
  display: block;
  text-align: center;
  padding: 10px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border-radius: 8px;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* ===== MAIN CONTENT ===== */
.admin-main {
  flex: 1;
  margin-left: var(--admin-sidebar-width);
  padding: 24px 32px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.admin-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-view-site {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--admin-primary);
  background: #fff;
  border: 1px solid var(--admin-primary);
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.btn-view-site:hover {
  background: var(--admin-primary);
  color: #fff;
  text-decoration: none;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--admin-text);
}

/* ===== SUMMARY CARDS ===== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--admin-white);
  border-radius: var(--admin-radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

/* Lucide inline icons */
.btn-admin svg,
.pin-star svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

.card-icon.unread { background: #dbeafe; }
.card-icon.today { background: #fef3c7; }
.card-icon.total { background: #f0fdf4; }
.card-icon.popup-status { background: #f3e8ff; }

.card-number {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
}

.card-label {
  display: block;
  font-size: 0.8rem;
  color: var(--admin-text-light);
}

/* ===== CONTENT SECTION ===== */
.content-section {
  background: var(--admin-white);
  border-radius: var(--admin-radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.link-more {
  font-size: 0.85rem;
  color: var(--admin-primary);
}

.link-more:hover { text-decoration: underline; }

/* ===== DATA TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--admin-border);
  font-size: 0.875rem;
}

.data-table th {
  font-weight: 600;
  color: var(--admin-text-light);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
  background: var(--admin-bg);
}

.td-message {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.unread { background: var(--admin-primary); }
.status-dot.read { background: var(--admin-border); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--admin-text-light);
  font-size: 0.95rem;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}

.pagination a,
.pagination span {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--admin-text-light);
  transition: all 0.2s;
}

.pagination a:hover {
  background: var(--admin-bg);
  color: var(--admin-text);
}

.pagination .current {
  background: var(--admin-primary);
  color: #fff;
}

/* ===== DETAIL VIEW ===== */
.detail-card {
  background: var(--admin-white);
  border-radius: var(--admin-radius);
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 24px;
}

.detail-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--admin-border);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  font-weight: 600;
  color: var(--admin-text-light);
  font-size: 0.85rem;
}

.detail-value {
  font-size: 0.9rem;
  line-height: 1.8;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ===== POPUP MANAGEMENT ===== */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--admin-border);
  border-radius: 26px;
  cursor: pointer;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--admin-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.preview-box {
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  margin-top: 16px;
  background: var(--admin-bg);
}

.preview-box img {
  max-width: 300px;
  max-height: 200px;
  border-radius: 8px;
}

/* ===== PORTFOLIO MANAGEMENT ===== */
.portfolio-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.portfolio-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--admin-border);
}

.portfolio-row:last-child {
  border-bottom: none;
}

.portfolio-row:hover {
  background: var(--admin-bg);
  margin: 0 -24px;
  padding: 12px 24px;
}

.portfolio-order {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--admin-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--admin-text-light);
}

.portfolio-thumb-sm {
  flex-shrink: 0;
  width: 56px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--admin-border);
}

.portfolio-thumb-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portfolio-no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--admin-text-light);
  font-size: 0.55rem;
}

.portfolio-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portfolio-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--admin-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portfolio-desc {
  font-size: 0.75rem;
  color: var(--admin-text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portfolio-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge-info {
  background: var(--admin-primary) !important;
}

.card-icon.portfolio {
  background: #fef3c7;
}

/* ===== SUBSECTION & DIVIDERS ===== */
.subsection-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 12px;
}

.section-divider {
  border-top: 1px solid var(--admin-border);
  margin: 20px 0;
}

.admin-form-inline {
  margin-bottom: 0;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .form-row-3 {
    grid-template-columns: 1fr;
  }
}

/* ===== BOARD MANAGEMENT (Phase 4) ===== */

/* 고정글 행 배경색 */
.row-pinned {
  background: #fefce8 !important;
}

.row-pinned:hover {
  background: #fef9c3 !important;
}

/* 고정 별 아이콘 */
.pin-star {
  color: var(--admin-warning);
  font-size: 1rem;
}

/* 고정 토글 버튼 (ON 상태) */
.btn-warning-pin {
  background: var(--admin-warning);
  color: #fff;
  border: none;
}

.btn-warning-pin:hover {
  background: #d97706;
  color: #fff;
}

/* 게시판 관리 버튼 그룹 (수정/삭제 한 줄 유지) */
.board-actions {
  display: flex;
  gap: 0.375rem;
  align-items: center;
  white-space: nowrap;
}

/* 게시글 제목 링크 */
.td-title-link {
  color: var(--admin-text);
  font-weight: 500;
  transition: color 0.2s;
}

.td-title-link:hover {
  color: var(--admin-primary);
  text-decoration: underline;
}

/* 필수 입력 별표 */
.required-star {
  color: var(--admin-danger);
  margin-left: 2px;
}

/* 인라인 수정 행 하이라이트 */
.row-editing {
  background: #eff6ff !important;
}

.row-editing td {
  padding: 8px 16px;
}

/* ===== PRODUCT MANAGEMENT (Phase 4) ===== */

/* 카테고리 필터 탭 */
.product-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.filter-tab {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--admin-text-light);
  background: var(--admin-white);
  border: 1px solid var(--admin-border);
  transition: all 0.2s;
  cursor: pointer;
}

.filter-tab:hover {
  background: var(--admin-bg);
  color: var(--admin-text);
  border-color: var(--admin-primary);
}

.filter-tab.active {
  background: var(--admin-primary);
  color: #fff;
  border-color: var(--admin-primary);
}

/* 제품 카드 그리드 */
.product-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.product-admin-card {
  background: var(--admin-white);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  overflow: hidden;
  transition: box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.product-admin-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* 제품 썸네일 */
.product-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--admin-bg);
  overflow: hidden;
  flex-shrink: 0;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--admin-text-light);
}

/* 제품 카드 본문 */
.product-card-body {
  padding: 14px 14px 8px;
  flex: 1;
}

.product-card-category {
  font-size: 0.75rem;
  color: var(--admin-primary);
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.product-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--admin-text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.product-card-desc {
  font-size: 0.78rem;
  color: var(--admin-text-light);
  line-height: 1.5;
}

/* 제품 카드 액션 버튼 영역 */
.product-card-actions {
  padding: 10px 14px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--admin-border);
}

/* 메인 노출 ON 버튼 */
.btn-featured-on {
  background: #f59e0b;
  color: #fff;
  border: none;
}

.btn-featured-on:hover {
  background: #d97706;
  color: #fff;
}

/* ===== PRODUCT CATEGORY MANAGEMENT (Phase 4) ===== */

/* 카테고리 추가 폼 행 */
.category-add-form {
  margin-bottom: 0;
}

.category-add-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== RESPONSIVE (Phase 4) ===== */
@media (max-width: 768px) {
  .product-admin-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-filter-tabs {
    gap: 6px;
  }

  .filter-tab {
    padding: 6px 14px;
    font-size: 0.8rem;
  }

  .category-add-row {
    flex-direction: column;
  }

  .category-add-row .form-group {
    width: 100% !important;
  }

  .product-card-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .product-admin-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== UPLOAD PREVIEW ===== */
.upload-preview {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-bg);
}

.upload-preview img {
  max-width: 200px;
  max-height: 80px;
  border-radius: 4px;
  object-fit: contain;
}

.upload-delete {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--admin-danger);
  cursor: pointer;
}

.upload-delete input[type="checkbox"] {
  width: auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
    padding: 16px;
  }

  .sidebar-toggle {
    display: block;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .admin-header h1 {
    font-size: 1.2rem;
  }

  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .detail-row {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .portfolio-row {
    flex-wrap: wrap;
  }

  .portfolio-info {
    flex-basis: 100%;
    order: 3;
    padding-left: 38px;
  }

  .portfolio-actions {
    flex-wrap: wrap;
  }
}
