/* ============================================
   폰슬라 관리자 페이지 (GnuBoard 스타일)
   ============================================ */

/* ── 관리자 전체 레이아웃 ── */
.admin-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f5f5f5;
  font-family:
    "Pretendard",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 13px;
  color: #333;
}

/* ── 상단 네비게이션 ── */
.admin-topbar {
  background: #2c3e50;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 50px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.admin-topbar-left {
  display: flex;
  align-items: center;
  gap: 0;
}

.admin-topbar-logo {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-right: 24px;
  color: #fff;
  text-transform: uppercase;
}

.admin-topbar-nav {
  display: flex;
  gap: 0;
}

.admin-topbar-nav button {
  background: none;
  border: none;
  color: #ccc;
  font-size: 13px;
  font-weight: 600;
  padding: 14px 18px;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
  white-space: nowrap;
}

.admin-topbar-nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.admin-topbar-nav button.active {
  background: #1abc9c;
  color: #fff;
}

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-topbar-right button {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ccc;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-topbar-right button:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.admin-topbar-right .btn-homepage {
  background: #1abc9c;
  border-color: #1abc9c;
  color: #fff;
}

.admin-topbar-right .btn-homepage:hover {
  background: #16a085;
}

.admin-topbar-right .btn-logout {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

.admin-topbar-right .btn-logout:hover {
  background: #c0392b;
}

/* ── 본문 영역 (사이드바 + 콘텐츠) ── */
.admin-body {
  display: flex;
  flex: 1;
}

/* ── 사이드바 ── */
.admin-sidebar {
  width: 200px;
  min-width: 200px;
  background: #fff;
  border-right: 1px solid #ddd;
  padding: 0;
  overflow-y: auto;
}

.admin-sidebar-title {
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
  border-bottom: 2px solid #1abc9c;
  background: #f8f9fa;
}

.admin-sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-sidebar-menu li {
  border-bottom: 1px solid #eee;
}

.admin-sidebar-menu li a,
.admin-sidebar-menu li button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 18px;
  font-size: 13px;
  color: #555;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.admin-sidebar-menu li a:hover,
.admin-sidebar-menu li button:hover {
  background: #f0faf8;
  color: #1abc9c;
}

.admin-sidebar-menu li.active a,
.admin-sidebar-menu li.active button {
  color: #1abc9c;
  font-weight: 700;
  background: #f0faf8;
  border-left: 3px solid #1abc9c;
}

/* ── 메인 콘텐츠 ── */
.admin-content {
  flex: 1;
  padding: 0;
  overflow-x: auto;
}

.admin-breadcrumb {
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid #ddd;
  font-size: 13px;
  color: #888;
}

.admin-breadcrumb strong {
  color: #333;
}

/* ── 탭 네비게이션 ── */
.admin-tabs {
  display: flex;
  gap: 0;
  padding: 16px 24px 0;
  background: #fff;
  border-bottom: 1px solid #ddd;
}

.admin-tab {
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: -1px;
  position: relative;
}

.admin-tab:hover {
  background: #e8e8e8;
  color: #333;
}

.admin-tab.active {
  background: #1abc9c;
  color: #fff;
  border-color: #1abc9c;
  z-index: 1;
}

/* ── 탭 콘텐츠 ── */
.admin-tab-content {
  display: none;
  padding: 24px;
  background: #fff;
  margin: 0 24px 24px;
  border: 1px solid #ddd;
  border-top: none;
}

.admin-tab-content.active {
  display: block;
}

/* ── 섹션 제목 ── */
.admin-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #2c3e50;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px solid #1abc9c;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── 테이블 폼 레이아웃 (GnuBoard 스타일) ── */
.admin-form-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.admin-form-table th,
.admin-form-table td {
  padding: 10px 14px;
  border: 1px solid #ddd;
  font-size: 13px;
  vertical-align: middle;
}

.admin-form-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
  width: 150px;
  text-align: left;
  white-space: nowrap;
}

.admin-form-table td {
  background: #fff;
}

.admin-form-table input[type="text"],
.admin-form-table input[type="number"],
.admin-form-table input[type="password"],
.admin-form-table textarea {
  width: 100%;
  max-width: 400px;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
  color: #333;
  transition: border-color 0.2s;
  font-family: inherit;
}

.admin-form-table input:focus,
.admin-form-table textarea:focus,
.admin-form-table select:focus {
  outline: none;
  border-color: #1abc9c;
  box-shadow: 0 0 0 2px rgba(26, 188, 156, 0.15);
}

.admin-form-table select {
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
  color: #333;
  background: #fff;
  cursor: pointer;
}

.admin-form-table .hint {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

/* ── 버튼 스타일 ── */
.admin-btn-primary {
  background: #1abc9c;
  color: #fff;
  border: none;
  padding: 8px 24px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.admin-btn-primary:hover {
  background: #16a085;
}

.admin-btn-primary:disabled {
  background: #95d5c8;
  cursor: not-allowed;
}

.admin-btn-danger {
  background: #e74c3c;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.admin-btn-danger:hover {
  background: #c0392b;
}

.admin-btn-secondary {
  background: #95a5a6;
  color: #fff;
  border: none;
  padding: 8px 24px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.admin-btn-secondary:hover {
  background: #7f8c8d;
}

.admin-btn-success {
  background: #27ae60;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.admin-btn-success:hover {
  background: #219a52;
}

.admin-btn-info {
  background: #3498db;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.admin-btn-info:hover {
  background: #2980b9;
}

.admin-btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.admin-btn-group {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ── 상태 메시지 ── */
.admin-status {
  margin-top: 12px;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 4px;
}

.admin-status.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.admin-status.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.admin-status.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* ── 카드 스타일 (섹션 컨테이너) ── */
.admin-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 16px;
}

.admin-card-header {
  background: #f8f9fa;
  padding: 12px 16px;
  border-bottom: 1px solid #ddd;
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-card-body {
  padding: 16px;
}

/* ── 상품 리스트 (관리 테이블) ── */
.admin-data-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-data-table thead th {
  background: #2c3e50;
  color: #fff;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.admin-data-table tbody tr {
  border-bottom: 1px solid #eee;
  transition: background 0.15s;
}

.admin-data-table tbody tr:hover {
  background: #f8f9fa;
}

.admin-data-table tbody td {
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
  vertical-align: middle;
}

.admin-data-table tbody td:first-child {
  text-align: center;
}

.admin-data-table .product-thumb {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 4px;
  background: #f5f5f5;
  padding: 2px;
}

.admin-data-table .text-left {
  text-align: left;
}

.admin-data-table .text-right {
  text-align: right;
}

.admin-data-table .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.admin-data-table .badge-best {
  background: #e74c3c;
  color: #fff;
}
.admin-data-table .badge-new {
  background: #3498db;
  color: #fff;
}
.admin-data-table .badge-hot {
  background: #e67e22;
  color: #fff;
}
.admin-data-table .badge-value {
  background: #27ae60;
  color: #fff;
}

/* ── 검색 필터 바 ── */
.admin-filter-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: #666;
}

.admin-filter-group select,
.admin-filter-group input {
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
  min-width: 150px;
}

/* ── 피드 URL 표시 ── */
.admin-feed-url {
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-feed-url code {
  flex: 1;
  background: #fff;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 12px;
  word-break: break-all;
  font-family: "Consolas", monospace;
}

/* ── 검색 결과 아이템 ── */
.admin-search-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #eee;
  border-radius: 4px;
  margin-bottom: 8px;
  transition: background 0.15s;
}

.admin-search-item:hover {
  background: #f8f9fa;
}

.admin-search-item .item-info {
  flex: 1;
}

.admin-search-item .item-info h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  color: #333;
}

.admin-search-item .item-info p {
  font-size: 12px;
  color: #888;
}

/* ── 확인 버튼 영역 ── */
.admin-confirm-bar {
  background: #f8f9fa;
  border-top: 1px solid #ddd;
  padding: 12px 24px;
  text-align: right;
  position: sticky;
  bottom: 0;
}

/* ── 피드 프리뷰 ── */
.admin-feed-preview {
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 16px;
}

.admin-feed-preview-header {
  background: #f8f9fa;
  padding: 10px 14px;
  font-weight: 600;
  border-bottom: 1px solid #ddd;
}

.admin-feed-preview-body {
  max-height: 400px;
  overflow-y: auto;
}

.admin-feed-preview-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
}

.admin-feed-preview-item img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 4px;
  background: #f5f5f5;
}

.admin-feed-preview-item .info {
  flex: 1;
}

.admin-feed-preview-item .info .name {
  font-weight: 600;
  font-size: 13px;
}

.admin-feed-preview-item .info .meta {
  font-size: 12px;
  color: #888;
}

/* ── 반응형 (태블릿) ── */
@media (max-width: 1024px) {
  .admin-sidebar {
    width: 170px;
    min-width: 170px;
  }

  .admin-topbar-logo {
    font-size: 14px;
    margin-right: 16px;
  }

  .admin-topbar-nav button {
    padding: 12px 14px;
    font-size: 12px;
  }
}

/* ── 반응형 (모바일) ── */
@media (max-width: 768px) {
  /* -- Topbar -- */
  .admin-topbar {
    flex-direction: column;
    height: auto;
    padding: 10px 12px;
    gap: 6px;
  }

  .admin-topbar-left {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  .admin-topbar-logo {
    font-size: 13px;
    margin-right: 0;
    width: 100%;
    text-align: center;
    padding-bottom: 4px;
  }

  .admin-topbar-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
  }

  .admin-topbar-nav button {
    padding: 8px 12px;
    font-size: 11px;
    flex: 1;
    text-align: center;
    min-width: 0;
  }

  .admin-topbar-right {
    width: 100%;
    justify-content: center;
  }

  .admin-topbar-right button {
    flex: 1;
    font-size: 11px;
    padding: 6px 10px;
  }

  /* -- Body 레이아웃 -- */
  .admin-body {
    flex-direction: column;
  }

  /* -- 사이드바 → 가로 스크롤 탭 -- */
  .admin-sidebar {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: 1px solid #ddd;
  }

  .admin-sidebar-title {
    display: none;
  }

  .admin-sidebar-menu {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .admin-sidebar-menu::-webkit-scrollbar {
    display: none;
  }

  .admin-sidebar-menu li {
    border-bottom: none;
    border-right: 1px solid #eee;
    flex-shrink: 0;
  }

  .admin-sidebar-menu li:last-child {
    border-right: none;
  }

  .admin-sidebar-menu li a,
  .admin-sidebar-menu li button {
    white-space: nowrap;
    padding: 10px 14px;
    font-size: 12px;
  }

  .admin-sidebar-menu li.active a,
  .admin-sidebar-menu li.active button {
    border-left: none;
    border-bottom: 3px solid #1abc9c;
  }

  /* -- 메인 콘텐츠 -- */
  .admin-content {
    min-width: 0;
  }

  .admin-breadcrumb {
    padding: 10px 12px;
    font-size: 12px;
  }

  /* -- 탭 -- */
  .admin-tabs {
    padding: 8px 12px 0;
    overflow-x: auto;
  }

  .admin-tab {
    padding: 8px 14px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* -- 탭 콘텐츠 -- */
  .admin-tab-content {
    margin: 0 8px 12px !important;
    padding: 12px !important;
    border-radius: 4px !important;
  }

  .admin-section-title {
    font-size: 14px;
    margin-bottom: 12px;
  }

  /* -- 카드 -- */
  .admin-card {
    margin-bottom: 12px;
  }

  .admin-card-header {
    padding: 10px 12px;
    font-size: 13px;
  }

  .admin-card-body {
    padding: 12px;
  }

  /* -- 폼 테이블 → 세로 배치 -- */
  .admin-form-table,
  .admin-form-table thead,
  .admin-form-table tbody,
  .admin-form-table tr,
  .admin-form-table th,
  .admin-form-table td {
    display: block;
    width: 100%;
  }

  .admin-form-table tr {
    margin-bottom: 0;
  }

  .admin-form-table th {
    width: 100%;
    border-bottom: none;
    padding: 8px 10px 4px;
    font-size: 12px;
    background: #f0f7f5;
  }

  .admin-form-table td {
    padding: 4px 10px 10px;
    border-top: none;
  }

  .admin-form-table input[type="text"],
  .admin-form-table input[type="number"],
  .admin-form-table input[type="password"],
  .admin-form-table input[type="tel"],
  .admin-form-table input[type="url"],
  .admin-form-table textarea {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  .admin-form-table select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* -- 데이터 테이블 (상품 목록 등) -- */
  .admin-data-table {
    display: block;
    width: 100%;
  }

  .admin-data-table thead {
    display: none;
  }

  .admin-data-table tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .admin-data-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid #eee;
    border-radius: 6px;
    background: #fff;
  }

  .admin-data-table tbody tr:hover {
    background: #f8f9fa;
  }

  .admin-data-table tbody td {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: none;
    font-size: 12px;
    text-align: left;
  }

  /* No. 번호 */
  .admin-data-table tbody td:nth-child(1) {
    font-weight: 700;
    color: #888;
    font-size: 11px;
    min-width: 24px;
  }

  /* 이미지 */
  .admin-data-table tbody td:nth-child(2) {
    flex-shrink: 0;
  }

  .admin-data-table .product-thumb {
    width: 44px;
    height: 44px;
  }

  /* 상품명 */
  .admin-data-table tbody td:nth-child(3) {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    word-break: break-word;
  }

  /* 관리 버튼 */
  .admin-data-table tbody td:last-child {
    margin-left: auto;
  }

  /* 브랜드, 용량, 출고가, 월요금, 뱃지 — 작게 표시 */
  .admin-data-table tbody td:nth-child(4),
  .admin-data-table tbody td:nth-child(5) {
    font-size: 11px;
    color: #888;
  }

  .admin-data-table tbody td:nth-child(4)::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #ccc;
    border-radius: 50%;
    margin-right: 4px;
  }

  .admin-data-table tbody td:nth-child(6),
  .admin-data-table tbody td:nth-child(7) {
    font-size: 12px;
  }

  .admin-data-table tbody td:nth-child(6)::before {
    content: "출고가 ";
    color: #999;
    font-size: 10px;
  }

  .admin-data-table tbody td:nth-child(7)::before {
    content: "월 ";
    color: #999;
    font-size: 10px;
  }

  /* -- 검색 필터 바 -- */
  .admin-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .admin-filter-group {
    width: 100%;
  }

  .admin-filter-group select,
  .admin-filter-group input {
    min-width: unset;
    width: 100%;
    box-sizing: border-box;
  }

  .admin-filter-bar > .admin-btn-primary {
    width: 100%;
    padding: 10px;
    font-size: 14px;
  }

  /* -- 버튼 그룹 -- */
  .admin-btn-group {
    flex-direction: column;
    gap: 8px;
  }

  .admin-btn-group .admin-btn-primary,
  .admin-btn-group .admin-btn-secondary,
  .admin-btn-group .admin-btn-danger {
    width: 100%;
    text-align: center;
    padding: 10px;
  }

  /* -- 검색 결과 아이템 -- */
  .admin-search-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
  }

  .admin-search-item .item-info h4 {
    font-size: 13px;
  }

  /* -- 피드 URL -- */
  .admin-feed-url {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .admin-feed-url code {
    width: 100%;
    font-size: 11px;
  }

  /* -- 피드 프리뷰 -- */
  .admin-feed-preview-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
  }

  /* -- 상태 메시지 -- */
  .admin-status {
    font-size: 12px;
    padding: 6px 10px;
  }

  /* -- 텍스트/힌트 크기 -- */
  .admin-form-table .hint {
    font-size: 11px;
  }

  /* -- 배너 업로드 이미지 미리보기 -- */
  #bannerUploadPreview img {
    max-width: 100%;
    height: auto;
  }
}

/* ── 반응형 (작은 모바일) ── */
@media (max-width: 480px) {
  .admin-topbar {
    padding: 8px 10px;
  }

  .admin-topbar-logo {
    font-size: 12px;
  }

  .admin-topbar-nav button {
    padding: 6px 8px;
    font-size: 10px;
  }

  .admin-tab-content {
    margin: 0 4px 8px !important;
    padding: 8px !important;
  }

  .admin-card-body {
    padding: 8px;
  }

  .admin-form-table th,
  .admin-form-table td {
    padding: 6px 8px;
  }

  .admin-sidebar-menu li a,
  .admin-sidebar-menu li button {
    padding: 8px 10px;
    font-size: 11px;
  }

  .admin-data-table tbody tr {
    padding: 8px;
  }

  .admin-data-table .product-thumb {
    width: 36px;
    height: 36px;
  }
}
