/* ============================================================
   realty-bee Theme - Main Stylesheet
   Version: 1.0.0
   ============================================================ */

/* ──────────────────────────────────────────
   CSS 변수 (관리자에서 동적으로 override)
   ────────────────────────────────────────── */
:root {
  /* 컬러 - 관리자에서 <style> 인라인으로 override */
  --rb-primary:        #1a3a6b;
  --rb-primary-dark:   #0d1f3c;
  --rb-primary-light:  #2a5298;
  --rb-accent:         #c8a96e;
  --rb-accent-dark:    #a8864e;

  /* 배경 / 텍스트 */
  --rb-bg:             #ffffff;
  --rb-bg-alt:         #f8f8f8;
  --rb-bg-dark:        #111111;
  --rb-text:           #333333;
  --rb-text-sub:       #666666;
  --rb-text-light:     #999999;
  --rb-border:         #e0e0e0;

  /* 폰트 */
  --rb-font:           'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --rb-font-en:        'Montserrat', sans-serif;

  /* 레이아웃 */
  --rb-max-width:      1280px;
  --rb-header-height:  80px;
  --rb-header-height-m: 60px;

  /* 간격 */
  --rb-section-py:     100px;
  --rb-section-py-m:   60px;

  /* 전환 */
  --rb-transition:     0.3s ease;
  --rb-transition-slow: 0.6s ease;

  /* 그림자 */
  --rb-shadow-sm:  0 2px 8px rgba(0,0,0,0.08);
  --rb-shadow-md:  0 4px 20px rgba(0,0,0,0.12);
  --rb-shadow-lg:  0 8px 40px rgba(0,0,0,0.18);

  /* Z-index */
  --rb-z-header:   100;
  --rb-z-modal:    200;
  --rb-z-popup:    300;
  --rb-z-admin:    400;
  --rb-z-toast:    500;
}

/* ──────────────────────────────────────────
   리셋 & 기본
   ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--rb-font);
  font-size: 1rem;
  color: var(--rb-text);
  background-color: var(--rb-bg);
  line-height: 1.7;
  word-break: keep-all;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--rb-transition);
}

a:hover { color: var(--rb-primary); }

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol { list-style: none; }

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--rb-font);
}

input, textarea, select {
  font-family: var(--rb-font);
  font-size: 1rem;
}

/* iOS 전화번호 자동링크 방지 */
a[href^="tel"] {
  color: inherit;
  text-decoration: none;
}

/* ──────────────────────────────────────────
   유틸리티
   ────────────────────────────────────────── */
.rb-container {
  max-width: var(--rb-max-width);
  margin: 0 auto;
  padding: 0 40px;
}

.rb-section {
  padding: var(--rb-section-py) 0;
}

.rb-section-title {
  text-align: center;
  margin-bottom: 60px;
}

.rb-section-title .en {
  display: block;
  font-family: var(--rb-font-en);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rb-accent);
  margin-bottom: 12px;
}

.rb-section-title .ko {
  display: block;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--rb-primary-dark);
  line-height: 1.3;
}

.rb-section-title .ko em {
  color: var(--rb-primary);
  font-style: normal;
}

.rb-section-title .desc {
  display: block;
  margin-top: 16px;
  font-size: 1rem;
  color: var(--rb-text-sub);
}

/* 구분선 장식 */
.rb-section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--rb-accent);
  margin: 20px auto 0;
}

/* 배경 색상 변형 */
.rb-bg-alt  { background-color: var(--rb-bg-alt); }
.rb-bg-dark { background-color: var(--rb-bg-dark); color: #fff; }
.rb-bg-primary { background-color: var(--rb-primary); color: #fff; }

/* 버튼 */
.rb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: all var(--rb-transition);
  cursor: pointer;
  white-space: nowrap;
}

.rb-btn--primary {
  background: var(--rb-primary);
  color: #fff;
  border: 2px solid var(--rb-primary);
}
.rb-btn--primary:hover {
  background: var(--rb-primary-dark);
  border-color: var(--rb-primary-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--rb-shadow-md);
}

.rb-btn--accent {
  background: var(--rb-accent);
  color: #fff;
  border: 2px solid var(--rb-accent);
}
.rb-btn--accent:hover {
  background: var(--rb-accent-dark);
  border-color: var(--rb-accent-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--rb-shadow-md);
}

.rb-btn--outline {
  background: transparent;
  color: var(--rb-primary);
  border: 2px solid var(--rb-primary);
}
.rb-btn--outline:hover {
  background: var(--rb-primary);
  color: #fff;
}

.rb-btn--white {
  background: #fff;
  color: var(--rb-primary);
  border: 2px solid #fff;
}
.rb-btn--white:hover {
  background: transparent;
  color: #fff;
}

.rb-btn--lg {
  padding: 18px 48px;
  font-size: 1.1rem;
}

.rb-btn--sm {
  padding: 8px 20px;
  font-size: 0.875rem;
}

.rb-btn--full {
  width: 100%;
}

/* 탭 컴포넌트 */
.rb-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--rb-border);
  margin-bottom: 40px;
}

.rb-tab-item {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--rb-text-sub);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all var(--rb-transition);
}

.rb-tab-item.is-active,
.rb-tab-item:hover {
  color: var(--rb-primary);
  border-bottom-color: var(--rb-primary);
}

.rb-tab-content { display: none; }
.rb-tab-content.is-active { display: block; }

/* 카드 그리드 */
.rb-grid {
  display: grid;
  gap: 24px;
}
.rb-grid--2 { grid-template-columns: repeat(2, 1fr); }
.rb-grid--3 { grid-template-columns: repeat(3, 1fr); }
.rb-grid--4 { grid-template-columns: repeat(4, 1fr); }

/* 인라인 편집 표시 */
body.rb-edit-mode [contenteditable] {
  outline: 2px dashed var(--rb-accent);
  outline-offset: 4px;
  cursor: text;
  min-height: 1em;
}

body.rb-edit-mode [contenteditable]:focus {
  outline-color: var(--rb-primary);
  background: rgba(26,58,107,0.04);
}

/* 편집 모드 툴바 */
.rb-edit-toolbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: var(--rb-primary-dark);
  color: #fff;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: var(--rb-z-admin);
  font-size: 0.875rem;
}

body.rb-edit-mode .rb-edit-toolbar {
  display: flex;
}

body.rb-edit-mode {
  padding-top: 50px;
}

.rb-edit-toolbar__msg {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rb-edit-toolbar__msg::before {
  content: '✏️';
}

.rb-edit-toolbar__actions {
  display: flex;
  gap: 12px;
}

.rb-edit-toolbar__actions button {
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--rb-transition);
}

#rb-edit-save {
  background: var(--rb-accent);
  color: #fff;
}
#rb-edit-save:hover { background: var(--rb-accent-dark); }

#rb-edit-cancel {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
#rb-edit-cancel:hover { background: rgba(255,255,255,0.25); }

/* 스크롤 애니메이션 */
.rb-anim {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.rb-anim.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.rb-anim--delay-1 { transition-delay: 0.1s; }
.rb-anim--delay-2 { transition-delay: 0.2s; }
.rb-anim--delay-3 { transition-delay: 0.3s; }
.rb-anim--delay-4 { transition-delay: 0.4s; }
.rb-anim--delay-5 { transition-delay: 0.5s; }

/* 탑버튼 */
#rb-top-btn {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: var(--rb-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--rb-transition);
  z-index: 90;
  box-shadow: var(--rb-shadow-md);
}

#rb-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
}

#rb-top-btn:hover {
  background: var(--rb-primary-dark);
  transform: translateY(-4px);
}

/* 탑버튼 - 사각형 */
#rb-top-btn.style-square {
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* 탑버튼 - 텍스트 조합 */
#rb-top-btn.style-text {
  border-radius: 8px;
  flex-direction: column;
  gap: 2px;
  height: 56px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ──────────────────────────────────────────
   스크롤바 커스터마이징
   ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb {
  background: var(--rb-primary-light);
  border-radius: 3px;
}

/* ──────────────────────────────────────────
   유틸 헬퍼
   ────────────────────────────────────────── */
.rb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.rb-text-center { text-align: center; }
.rb-text-right  { text-align: right; }
.rb-mt-sm { margin-top: 12px; }
.rb-mt-md { margin-top: 24px; }
.rb-mt-lg { margin-top: 48px; }
.rb-mb-sm { margin-bottom: 12px; }
.rb-mb-md { margin-bottom: 24px; }
.rb-mb-lg { margin-bottom: 48px; }
