/* 영리 법률정보 도우미 — 공통 스타일 */
:root {
  --primary: #1a365d;
  --primary-light: #2a4a7f;
  --primary-dark: #0f2440;
  --accent: #d4a843;
  --accent-light: #e8c668;
  --bg: #f7f8fa;
  --bg-white: #ffffff;
  --text: #1a202c;
  --text-light: #4a5568;
  --text-muted: #718096;
  --border: #e2e8f0;
  --success: #38a169;
  --error: #e53e3e;
  --warning: #d69e2e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --max-width: 1200px;
  --header-height: 64px;
}

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

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* 헤더 */
.header {
  background: var(--primary);
  color: white;
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
}

.logo-icon { font-size: 1.5rem; }

.nav { display: flex; align-items: center; gap: 6px; }

.nav a {
  color: rgba(255,255,255,0.85);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
}
.nav a:hover, .nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
  text-decoration: none;
}

.nav-auth { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--primary-dark);
}
.btn-primary:hover { background: var(--accent-light); text-decoration: none; }

.btn-secondary {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}
.btn-secondary:hover { background: rgba(255,255,255,0.25); text-decoration: none; }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; text-decoration: none; }

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--error); color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 푸터 */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.7);
  padding: 30px 20px;
  margin-top: auto;
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.8;
}

.footer a { color: var(--accent-light); }

.disclaimer {
  background: #fffbeb;
  border: 1px solid #f6e05e;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: #744210;
  line-height: 1.6;
}

/* 카드 */
.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  transition: all 0.2s;
}

/* 폼 */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,54,93,0.1);
}
.form-textarea { min-height: 120px; resize: vertical; }

/* 컨테이너 */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.page-content {
  flex: 1;
  padding: 24px 0;
}

/* 유틸 */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-free { background: #c6f6d5; color: #22543d; }
.badge-credit { background: #fefcbf; color: #744210; }

/* 알림/토스트 */
.toast {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease;
  max-width: 400px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--error); }
.toast-warning { background: var(--warning); color: var(--text); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 로딩 */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0,0,0,0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 모바일 메뉴 */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

/* 반응형 */
@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }
  .menu-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--primary);
    flex-direction: column;
    padding: 16px;
    box-shadow: var(--shadow-lg);
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 16px; width: 100%; }
  .nav-auth {
    flex-direction: column;
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .nav-auth .btn { width: 100%; justify-content: center; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}

/* 크레딧 바 */
.credit-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: rgba(255,255,255,0.9);
}
.credit-bar span { white-space: nowrap; }

/* 모달 */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h2 { margin-bottom: 16px; }
