/**
 * Common Global Styles
 * ClassGame 프로젝트 전역 공통 스타일
 */

/* ============================================
   CSS 변수 정의 (:root)
   ============================================ */
:root {
  /* 색상 팔레트 */
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #e0e7ff;
  --secondary: #0ea5e9;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* 배경 & 표면 */
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;

  /* 텍스트 */
  --text: #1e293b;
  --text-muted: #64748b;

  /* 디자인 토큰 */
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --transition: 0.2s ease;
}

/* ============================================
   Body & 기본 스타일
   ============================================ */
body {
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color var(--transition);
}

/* ============================================
   링크
   ============================================ */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

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

a:active {
  color: var(--primary-dark);
}

/* ============================================
   버튼 리셋
   ============================================ */
button {
  cursor: pointer;
  transition: all var(--transition);
}

button:active {
  transform: scale(0.98);
}

/* ============================================
   스크롤바 커스텀
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}

/* ============================================
   선택 스타일
   ============================================ */
::selection {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

::-moz-selection {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

/* ============================================
   유틸리티 클래스: Flexbox
   ============================================ */
.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-start {
  justify-content: flex-start;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.justify-end {
  justify-content: flex-end;
}

/* ============================================
   유틸리티 클래스: 간격 (Gap)
   ============================================ */
.gap-1 {
  gap: 4px;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.gap-6 {
  gap: 24px;
}

/* ============================================
   유틸리티 클래스: 마진 (Margin Top)
   ============================================ */
.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.mt-6 {
  margin-top: 24px;
}

/* ============================================
   유틸리티 클래스: 마진 (Margin Bottom)
   ============================================ */
.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

/* ============================================
   유틸리티 클래스: 패딩 (Padding)
   ============================================ */
.p-1 {
  padding: 4px;
}

.p-2 {
  padding: 8px;
}

.p-3 {
  padding: 12px;
}

.p-4 {
  padding: 16px;
}

.p-6 {
  padding: 24px;
}

.px-2 {
  padding-left: 8px;
  padding-right: 8px;
}

.px-3 {
  padding-left: 12px;
  padding-right: 12px;
}

.px-4 {
  padding-left: 16px;
  padding-right: 16px;
}

.py-2 {
  padding-top: 8px;
  padding-bottom: 8px;
}

.py-3 {
  padding-top: 12px;
  padding-bottom: 12px;
}

.py-4 {
  padding-top: 16px;
  padding-bottom: 16px;
}

/* ============================================
   유틸리티 클래스: 텍스트
   ============================================ */
.text-sm {
  font-size: 12px;
}

.text-base {
  font-size: 14px;
}

.text-lg {
  font-size: 16px;
}

.text-xl {
  font-size: 18px;
}

.text-2xl {
  font-size: 20px;
}

.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 500;
}

/* ============================================
   유틸리티 클래스: 기타
   ============================================ */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.opacity-50 {
  opacity: 0.5;
}

.opacity-75 {
  opacity: 0.75;
}

.rounded {
  border-radius: var(--radius);
}

.rounded-lg {
  border-radius: 12px;
}

.rounded-full {
  border-radius: 9999px;
}

.border {
  border: 1px solid var(--border);
}

.border-top {
  border-top: 1px solid var(--border);
}

.border-bottom {
  border-bottom: 1px solid var(--border);
}

.bg-surface {
  background-color: var(--surface);
}

.bg-light {
  background-color: var(--bg);
}

.shadow {
  box-shadow: var(--shadow);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.max-w-md {
  max-width: 448px;
}

.max-w-lg {
  max-width: 512px;
}

.max-w-2xl {
  max-width: 672px;
}

/* ============================================
   반응형 유틸리티
   ============================================ */
@media (max-width: 768px) {
  :root {
    font-size: 14px;
  }

  .hidden-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .hidden-desktop {
    display: none !important;
  }
}

/* ============================================
   다크모드 준비 (향후 확장용)
   ============================================ */
@media (prefers-color-scheme: dark) {
  /* 필요시 다크모드 변수 오버라이드 */
}

/* ============================================
   인쇄 모드
   ============================================ */
@media print {
  body {
    background-color: white;
  }

  .no-print {
    display: none !important;
  }
}
