/* =========================================================
   전역변수
   ========================================================= */
:root {
  --bg:        #ffffff;
  --mainBg:    #f2f4f7;
  --text:      #111827;
  --muted:     #6b7280;
  --border:    #e5e7eb;
  --card:      #ffffff;
  --shadow:    0 6px 24px rgba(0,0,0,.06);
  --accent:    #111;

  --max-width: 1168px;
  --radius:    8px;
  --sidebar-width: 430px;
}

/* =========================================================
   리빌더 코어 수정
   ========================================================= */
html { height: auto; }
body { background: var(--mainBg); color: var(--text); min-height: 100vh; }
main { background: transparent; }

@media (max-width: 1024px) {
  body { background: var(--mainBg) !important; }
  main { background: transparent !important; transition: none; }
}

.content_box {
  padding: 0;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.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;
}

/* =========================================================
   검색창 헤더
   ========================================================= */
.search-header {
  position: fixed; top: 0; left: 0; width: 100%;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}
.search-container { max-width: var(--max-width); margin: 0 auto; padding-top: 20px; }
.search-header-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
}

/* 검색창 */
.search-bar {
  display: flex; align-items: center; gap: 12px;
  max-width: 600px; padding: 5px 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow);
  min-width: 0; width: 100%;
}
.search-logo { height: 30px; }
.search-logo #fallbackImage { height: 30px; margin-left: 10px; }
.search-form { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.search-input {
  flex: 1;
  padding: 8px 4px; border: 0; outline: none;
  background: transparent; color: inherit; font-size: 18px; min-width: 0;
}
.search-icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 50%;
  background: #fff; cursor: pointer; flex: 0 0 auto;
}
.search-icon-btn.search-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.search-icon-btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); }

/* GNB */
.search-gnb {
  display: flex; align-items: center; justify-content: flex-end; gap: 14px;
}
.search-icon-wrap { position: relative; }
.search-icon {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--card); cursor: pointer;
}
.search-badge {
  position: absolute; transform: translate(10px,-10px);
  height: 18px; line-height: 18px; padding: 0 6px;
  background: #3b82f6; color: #fff; border-radius: 10px; font-size: 11px;
}

/* 프로필 오버레이 */
.profile-wrap { position: relative; }
.profile-pop {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 320px; padding: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); z-index: 1001;
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.98);
  transition: opacity .15s ease, transform .15s ease, visibility 0s .15s;
}
.profile-wrap:hover .profile-pop,
.profile-wrap:focus-within .profile-pop {
  opacity: 1; visibility: visible; transform: translateY(0) scale(1);
  transition: opacity .15s ease, transform .15s ease, visibility 0s;
}
.profile-pop::before {
  content: ""; position: absolute; top: -6px; right: 18px;
  width: 12px; height: 12px; background: var(--card);
  border-left: 1px solid var(--border); border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.prof-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: #f0f2f5; color: var(--muted);
  border: 1px solid var(--border);
  position: relative;
}
.avatar::after{
  content:""; position:absolute; right:-2px; bottom:-2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #ffd400; box-shadow: 0 0 0 2px var(--card);
}
.avatar::before{
  content:""; position:absolute; right:1px; bottom:1px;
  width: 6px; height: 6px; border-radius:50%; background:#111;
}
.info .name{ font-weight:700; color:var(--text); }
.info .email{ font-size:13px; color:var(--muted); margin-top:2px; }
.info .logout{
  display:inline-block; margin-top:6px;
  font-size:13px; color: var(--accent); text-decoration:none;
}
.info .logout:hover{ text-decoration: underline; }
.prof-divider{ height: 1px; background: var(--border); margin: 12px -14px; }
.prof-nav{ display:flex; align-items:center; justify-content:space-between; }
.prof-item{
  flex:1; text-align:center; padding:10px 6px;
  color: var(--text); text-decoration:none; font-weight:600;
}
.prof-item:hover{ background: #f8f9fb; border-radius: 8px; }
.prof-vsep{ width:1px; height:18px; background: var(--border); }

/* 검색 탭 */
.search-tabs-wrap {
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 4px 0;
}
.search-tabs { display: flex; gap: 22px; flex: 1; }
.search-tab {
  position: relative; display: inline-flex; align-items: center;
  padding: 10px; font-size: 16px; font-weight: 600; white-space: nowrap;
  color: var(--accent);
}
.search-tab:not(.is-active) { color: var(--muted); font-weight: 400; }
.search-tab.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 3px; background: var(--accent); border-radius: 2px;
}
@media (prefers-color-scheme: dark) {
  .search-tab { color: var(--text); }
  .search-tab:not(.is-active) { color: var(--muted); }
}

/* 반응형 헤더 */
@media (max-width: 700px){
  .search-container { padding: 20px 10px 0 10px; }
  .search-header-row { grid-template-columns: 1fr; }
  .search-tabs { gap: 5px; }
  .profile-wrap { display: none; }
}

/* =========================================================
   검색창 메인 레이아웃
   ========================================================= */
.search-main { padding-top: var(--search-header-h, 0px); }
.layout { display: flex; align-items: flex-start; gap: 20px; }
.layout .flex_box { margin: 0; }

.layout_main { flex: 1 1 auto; min-width: 0; }
.layout_main .main-content { min-height: 500px; }

.layout_aside {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  position: sticky;
  top: calc(var(--search-header-h, 0px) + 20px);
}
@media (max-width: 1024px) {
  .layout .layout_aside { display: none; }
}

/* =========================================================
   푸터
   ========================================================= */
.rb-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  margin-top: 24px;
  font-size: 13px; color: var(--muted);
}
.rb-footer__inner {
  max-width: var(--max-width); margin: 0 auto; padding: 50px 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
}
.rb-footer__links { justify-self: center; }
.rb-footer__links ul {
  display: flex; flex-wrap: wrap; align-items: center;
  margin: 0; padding: 0; list-style: none;
}
.rb-footer__links li { line-height: 1.6; }
.rb-footer__links li + li::before {
  content: "|"; margin: 0 8px; color: var(--border);
}
.rb-footer__links a { color: var(--text); text-decoration: none; }
.rb-footer__links a:hover { text-decoration: underline; }
.rb-footer__copy { justify-self: end; white-space: nowrap; }

@media (max-width: 640px) {
  .rb-footer__inner { grid-template-columns: 1fr; row-gap: 8px; text-align: center; }
  .rb-footer__copy { justify-self: center; }
}
