/* 관리자 통합 레이아웃 */
.admin-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg);
}

.admin-header {
  height: 70px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-badge {
  background: var(--primary);
  color: #fff;
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(255, 87, 34, 0.25);
}
.admin-header-left h1 {
  font-size: 1.35rem;
  font-weight: 800;
}

/* 상단 탭 */
.admin-tabs {
  display: flex;
  gap: 8px;
}
.tab-btn {
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}
.tab-btn:hover {
  background: var(--bg);
  color: var(--text);
}
.tab-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.tab-btn.btn-logout {
  background: hsl(0, 100%, 97%);
  color: hsl(0, 84%, 60%);
  border-color: hsl(0, 82%, 85%);
  margin-left: 12px;
}
.tab-btn.btn-logout:hover {
  background: hsl(0, 100%, 93%);
  color: hsl(0, 84%, 45%);
  border-color: hsl(0, 78%, 75%);
}

/* 본문 영역 */
.admin-container {
  padding: 24px;
  flex: 1;
}

.tab-content {
  display: none;
}
.tab-content.active-content {
  display: block;
}

.content-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.content-header-row h2 {
  font-size: 1.5rem;
  font-weight: 800;
}
.tab-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 메뉴판 격자 그리드 */
.admin-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.admin-menu-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
}
.admin-menu-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-img-box {
  width: 100%;
  height: 160px;
  position: relative;
  background-color: var(--bg);
}
.card-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-cat-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  text-transform: uppercase;
}

/* 품절 표시 마스크 */
.admin-menu-card.sold-out .card-img-box::after {
  content: 'SOLD OUT';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 2px;
}

.card-body-box {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* 한글 이름과 영문 이름 같이 보여줌 */
.card-body-box h3 {
  font-size: 1.05rem;
  font-weight: 700;
}
.card-name-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
}

.card-body-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  height: 38px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 6px;
}

.card-price-val {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 포스 코드 배지 */
.card-poscode {
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--text);
  color: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}

/* iOS 품절 스위치 */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border);
  transition: var(--transition-fast);
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition-fast);
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--primary);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

.card-actions-row {
  display: flex;
  border-top: 1px solid var(--border);
}
.card-actions-row button {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition-fast);
}
.card-actions-row button:first-child {
  border-right: 1px solid var(--border);
}
.card-actions-row button:hover {
  background: var(--bg);
  color: var(--text);
}
.card-actions-row button.btn-delete:hover {
  color: var(--danger);
  background: hsl(354, 70%, 97%);
}


/* ==========================================
     메뉴 추가/수정 번역 탭 모달
     ========================================== */
/* ==========================================
     메뉴 추가/수정 번역 탭 모달
     ========================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.menu-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 850px;
  max-width: 95%;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 2001;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.menu-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

#menu-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.btn-close-modal-admin {
  border: none;
  background: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  transition: var(--transition-fast);
}
.btn-close-modal-admin:hover {
  color: var(--text);
  transform: scale(1.1);
}

.modal-header {
  padding: 20px 28px 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 18px 28px 22px 28px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border);
}

.form-grid {
  display: flex;
  gap: 28px;
}
.form-left, .form-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: flex;
  gap: 16px;
}
.flex-1 {
  flex: 1;
}

/* 입력 필드 스타일 고도화 */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.input-group label {
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
}
.required-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.menu-modal input[type="text"],
.menu-modal input[type="number"],
.menu-modal input[type="url"],
.menu-modal select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition-fast);
  box-sizing: border-box;
}

.menu-modal input[type="text"]:focus,
.menu-modal input[type="number"]:focus,
.menu-modal input[type="url"]:focus,
.menu-modal select:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px hsl(var(--primary-hue), 100%, 94%);
}

.image-upload-preview-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.image-upload-preview-box img {
  width: 70px;
  height: 70px;
  border-radius: 8px;
  object-fit: cover;
}
.upload-btn-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
}
.upload-btn-wrapper input[type=file] {
  font-size: 100px;
  position: absolute;
  left: 0; top: 0;
  opacity: 0;
  cursor: pointer;
}

select {
  cursor: pointer;
}

/* 다국어 입력 탭 제어 */
.translation-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.translation-header-row label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.translation-tabs-bar {
  display: flex;
  gap: 4px;
}
.form-lang-tab {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}
.form-lang-tab:hover {
  background: var(--bg);
  color: var(--text);
}
.form-lang-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.translation-panels-container {
  min-height: 250px;
}
.lang-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}
.lang-panel.active-panel {
  display: flex;
}

.lang-panel textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  resize: none;
  transition: var(--transition-fast);
  box-sizing: border-box;
}
.lang-panel textarea:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px hsl(var(--primary-hue), 100%, 94%);
}

/* 반응형 스타일 */
@media (max-width: 768px) {
  .menu-modal {
    width: 95%;
    max-height: 95vh;
  }
  .modal-header {
    padding: 16px 20px;
  }
  .modal-body {
    padding: 20px;
  }
  .modal-footer {
    padding: 16px 20px;
  }
  .form-grid {
    flex-direction: column;
    gap: 16px;
  }
}

/* QR 관리 탭 카드 */
.qr-management-card {
  display: flex;
  gap: 32px;
  padding: 32px;
  background: var(--bg-card);
  max-width: 800px;
  margin: 0 auto;
}
.qr-preview-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: #fdfdfd;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.qr-preview-box canvas {
  width: 200px;
  height: 200px;
  background: #fff;
  border: 4px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.qr-url-text {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--text-muted);
  word-break: break-all;
  text-align: center;
}

.qr-settings-box {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.qr-settings-box h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.settings-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.qr-action-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ==========================================
     인쇄 전용 대형 A4 다국어 홍보 포스터 (화면 숨김)
     ========================================== */
.qr-print-template {
  display: none;
}

@media print {
  /* 브라우저 화면의 전 영역 가리기 */
  body * {
    visibility: hidden;
  }
  
  /* 오직 프린트 템플릿만 나타내기 */
  #qr-print-area, #qr-print-area * {
    visibility: visible;
  }
  
  #qr-print-area {
    display: flex !important;
    justify-content: center;
    align-items: center;
    position: absolute;
    left: 0;
    top: 0;
    width: 210mm; /* A4 폭 규격 */
    height: 297mm; /* A4 높이 규격 */
    background: #ffffff;
    color: #000000;
    box-sizing: border-box;
    padding: 20mm;
  }
  
  .print-border {
    width: 100%;
    height: 100%;
    border: 8px solid #000000;
    border-radius: 24px;
    padding: 12mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    text-align: center;
  }
  
  .print-brand-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 4px solid #000;
    padding-bottom: 4mm;
    width: 90%;
  }
  .p-brand-sub {
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 4px;
  }
  .p-brand-main {
    font-size: 2.8rem;
    font-weight: 950;
    margin-top: 1mm;
  }

  .print-middle-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    justify-content: center;
    margin: 8mm 0;
  }

  .print-main-title {
    font-size: 3.2rem;
    font-weight: 950;
  }
  
  .print-main-subtitle {
    font-size: 1.15rem;
    font-weight: 700;
    color: #333;
    line-height: 1.6;
    margin: 4mm 0;
  }

  .print-flags-row {
    display: flex;
    gap: 8mm;
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 6mm;
    background: #f5f5f5;
    padding: 2mm 8mm;
    border-radius: 30px;
    border: 2px solid #000;
  }
  .print-flags-row span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .print-flags-row img {
    width: 22px;
    height: 16.5px;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.15);
  }
  
  .print-qr-frame {
    margin: 4mm 0;
  }
  .print-qr-frame canvas {
    width: 80mm !important;
    height: 80mm !important;
    border: 6px solid #000;
    padding: 2mm;
    background: #fff;
  }
  
  .print-url-box {
    font-size: 1.15rem;
    font-family: monospace;
    font-weight: 800;
    background: #e5e5e5;
    padding: 3px 12px;
    border-radius: 6px;
    margin-top: 4mm;
  }
  
  .print-steps-section {
    display: flex;
    justify-content: space-around;
    width: 100%;
    border-top: 3px dashed #000;
    padding-top: 8mm;
    box-sizing: border-box;
  }
  
  .p-step-card {
    width: 30%;
    display: flex;
    gap: 3mm;
    align-items: center;
    text-align: left;
  }
  .p-step-num {
    width: 10mm;
    height: 10mm;
    background: #000;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 900;
    flex-shrink: 0;
  }
  .p-step-text strong {
    font-size: 0.95rem;
    font-weight: 800;
    display: block;
  }
  .p-step-text p {
    font-size: 0.75rem;
    color: #444;
    font-weight: 600;
  }
}
