/* ===== AMWOGUNA - Light Theme (Mobile First) ===== */
:root {
  --primary: #7c3aed;
  --primary-light: #a78bfa;
  --primary-dark: #5b21b6;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 12px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 레이아웃 ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

@media (min-width: 768px) {
  .container { padding: 24px; }
}

/* ===== 카드 ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

@media (min-width: 768px) {
  .card { padding: 24px; margin-bottom: 20px; }
}

/* ===== 버튼 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg);
  text-decoration: none;
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

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

.btn.success {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

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

.btn.lg {
  padding: 14px 24px;
  font-size: 16px;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== 조건 선택 칩 (사용자 페이지) ===== */
.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 25px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 768px) {
  .chip {
    padding: 12px 24px;
    font-size: 15px;
  }
}

.chip:hover {
  border-color: var(--primary-light);
  background: #faf5ff;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ===== 폼 요소 ===== */
label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px; /* iOS 확대 방지 */
  background: var(--bg-card);
  color: var(--text);
  margin-bottom: 12px;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

@media (min-width: 768px) {
  input, select, textarea {
    font-size: 14px;
    margin-bottom: 16px;
  }
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin-right: 8px;
  margin-bottom: 0;
}

/* ===== 테이블 (반응형) ===== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 500px;
  border-collapse: collapse;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

@media (min-width: 768px) {
  th, td {
    padding: 12px;
    font-size: 14px;
  }
}

th {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  white-space: nowrap;
}

tr:hover td {
  background: var(--bg);
}

/* ===== 뱃지/태그 ===== */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text-muted);
  white-space: nowrap;
}

@media (min-width: 768px) {
  .pill {
    padding: 4px 12px;
    font-size: 12px;
  }
}

.pill.primary {
  background: rgba(124, 58, 237, 0.1);
  color: var(--primary);
}

.pill.ok, .pill.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.pill.warn, .pill.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.pill.bad, .pill.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.pill.small {
  padding: 2px 8px;
  font-size: 10px;
}

/* ===== 그리드 (Mobile First) ===== */
.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .grid { gap: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .grid { gap: 20px; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ===== 통계 카드 ===== */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

@media (min-width: 768px) {
  .stat-card { padding: 24px; }
}

.stat-card .icon {
  font-size: 24px;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .stat-card .icon { font-size: 28px; margin-bottom: 12px; }
}

.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

@media (min-width: 768px) {
  .stat-card .value { font-size: 32px; }
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .stat-card .label { font-size: 14px; }
}

/* ===== 메뉴 카드 ===== */
.menu-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text);
  display: block;
}

@media (min-width: 768px) {
  .menu-card { padding: 24px; }
}

.menu-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}

.menu-card .icon {
  font-size: 28px;
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .menu-card .icon { font-size: 32px; margin-bottom: 16px; }
}

.menu-card .title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

@media (min-width: 768px) {
  .menu-card .title { font-size: 16px; }
}

.menu-card .desc {
  font-size: 12px;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .menu-card .desc { font-size: 13px; }
}

/* ===== 관리자 상단 바 ===== */
.topbar {
  background: var(--primary);
  color: white;
  padding: 0 12px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

@media (min-width: 768px) {
  .topbar {
    padding: 0 24px;
    height: 60px;
  }
}

.topbar .brand {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (min-width: 768px) {
  .topbar .brand { font-size: 18px; }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.9);
  font-size: 13px;
}

@media (min-width: 768px) {
  .topbar-right { gap: 16px; font-size: 14px; }
}

.topbar-right .user-name {
  display: none;
}

@media (min-width: 480px) {
  .topbar-right .user-name {
    display: inline;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (min-width: 768px) {
  .topbar-right .user-name { max-width: none; }
}

.topbar-right .btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 6px 12px;
  font-size: 13px;
}

@media (min-width: 768px) {
  .topbar-right .btn { padding: 8px 16px; }
}

.topbar-right .btn:hover {
  background: rgba(255,255,255,0.3);
}

/* ===== 관리자 네비게이션 ===== */
.admin-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.admin-nav::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .admin-nav {
    padding: 0 24px;
    gap: 4px;
  }
}

.admin-nav a {
  display: flex;
  align-items: center;
  padding: 12px 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .admin-nav a {
    padding: 14px 16px;
    font-size: 14px;
  }
}

.admin-nav a:hover {
  color: var(--primary);
  text-decoration: none;
}

.admin-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== 사용자 페이지 헤더 ===== */
.user-header {
  text-align: center;
  padding: 24px 16px;
}

@media (min-width: 768px) {
  .user-header { padding: 40px 20px; }
}

.user-header .logo {
  font-size: 40px;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .user-header .logo { font-size: 48px; }
}

.user-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .user-header h1 { font-size: 28px; }
}

.user-header p {
  color: var(--text-muted);
  font-size: 14px;
}

@media (min-width: 768px) {
  .user-header p { font-size: 16px; }
}

/* ===== 조건 섹션 ===== */
.condition-section {
  margin-bottom: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

@media (min-width: 768px) {
  .section-title { font-size: 16px; margin-bottom: 12px; }
}

.section-title::before {
  content: '◆';
  color: var(--primary);
  font-size: 10px;
}

@media (min-width: 768px) {
  .section-title::before { font-size: 12px; }
}

/* ===== 추천 결과 카드 ===== */
.result-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

@media (min-width: 768px) {
  .result-card { padding: 20px; gap: 16px; margin-bottom: 16px; }
}

.result-card .image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .result-card .image { width: 100px; height: 100px; }
}

.result-card .info {
  flex: 1;
  min-width: 0;
}

.result-card .name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

@media (min-width: 768px) {
  .result-card .name { font-size: 18px; }
}

.result-card .restaurant {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

@media (min-width: 768px) {
  .result-card .restaurant { font-size: 14px; margin-bottom: 8px; }
}

.result-card .price {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
}

@media (min-width: 768px) {
  .result-card .price { font-size: 16px; }
}

.result-card .actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .result-card .actions { gap: 8px; margin-top: 12px; }
}

/* ===== 유틸리티 ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

.flex { display: flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }

.small { font-size: 13px; }
.muted { color: var(--text-muted); }

.hidden-mobile { display: none; }
@media (min-width: 768px) {
  .hidden-mobile { display: block; }
}

.hidden-desktop { display: block; }
@media (min-width: 768px) {
  .hidden-desktop { display: none; }
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ===== 추천받기 버튼 (하단 고정) ===== */
.submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--primary);
  padding: 12px 16px;
  display: flex;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
  .submit-bar { padding: 16px 24px; }
}

.submit-bar .btn {
  background: white;
  color: var(--primary);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 32px;
  border: none;
  border-radius: 25px;
  width: 100%;
  max-width: 400px;
}

@media (min-width: 768px) {
  .submit-bar .btn {
    font-size: 16px;
    padding: 14px 48px;
    width: auto;
  }
}

.submit-bar .btn:hover {
  background: #f1f5f9;
}

/* ===== 위치 선택 ===== */
.location-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 768px) {
  .location-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

/* ===== kbd ===== */
.kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-family: monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

@media (min-width: 768px) {
  .kbd { font-size: 12px; }
}

/* ===== 페이지 하단 여백 ===== */
.page-with-submit {
  padding-bottom: 80px;
}

@media (min-width: 768px) {
  .page-with-submit { padding-bottom: 100px; }
}

/* ===== 로딩 ===== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 로그인 페이지 ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

/* ===== 섹션 구분자 ===== */
.sidebar-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 16px 16px 8px;
  font-weight: 600;
}

/* ===== 추가 반응형 헬퍼 ===== */
h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  h2 { font-size: 24px; margin-bottom: 20px; }
}

h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  h3 { font-size: 18px; margin-bottom: 16px; }
}
