/* =====================================================================
   SWYang server 스타일
   ---------------------------------------------------------------------
   분위기를 바꾸고 싶으면 아래 "설정 변수"만 고치면 돼.
   저장하고 브라우저를 새로고침(Ctrl+F5)하면 바로 반영돼.
   ===================================================================== */

:root {
  /* ----- 설정 변수 ----- */
  --accent: #0a84ff;                 /* 선택/강조 색 (맥OS 파랑) */
  --radius: 12px;                    /* 둥근 모서리 정도 */
  --blur: 26px;                      /* 반투명 유리 효과의 번짐 정도 */
  --sb-w: 244px;                     /* 왼쪽 사이드바 너비 */
  --tile: 128px;                     /* 아이콘 보기 기본 크기 (슬라이더로도 조절됨) */
  --login-w: clamp(270px, 34vw, 620px);  /* 로그인 화면 로고 너비 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo",
          "Pretendard", "Noto Sans KR", "Malgun Gothic", "Segoe UI", system-ui, sans-serif;
}

/* 다크 */
html[data-theme="dark"] {
  --bg: #1c1c1e;
  --panel: #232326;
  --sb-bg: rgba(38, 38, 42, 0.78);
  --tb-bg: rgba(40, 40, 44, 0.82);
  --fg: #f5f5f7;
  --fg2: #9a9aa2;
  --line: rgba(255, 255, 255, 0.09);
  --hover: rgba(255, 255, 255, 0.07);
  --field: rgba(255, 255, 255, 0.08);
  --menu-bg: rgba(48, 48, 52, 0.92);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  --stripe: rgba(255, 255, 255, 0.025);
  --logo-filter: none;
}
/* 라이트 */
html[data-theme="light"] {
  --bg: #ffffff;
  --panel: #f5f5f7;
  --sb-bg: rgba(238, 238, 242, 0.82);
  --tb-bg: rgba(246, 246, 248, 0.84);
  --fg: #1d1d1f;
  --fg2: #6e6e73;
  --line: rgba(0, 0, 0, 0.1);
  --hover: rgba(0, 0, 0, 0.05);
  --field: rgba(0, 0, 0, 0.06);
  --menu-bg: rgba(250, 250, 252, 0.94);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  --stripe: rgba(0, 0, 0, 0.025);
  --logo-filter: invert(1);
}

/* ===== 기본 ===== */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: #000; color: var(--fg); font-family: var(--font);
  -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.scrim { display: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic-color { width: 20px; height: 20px; flex: none; }

/* =====================================================================
   로그인 화면
   ===================================================================== */
.login { position: fixed; inset: 0; background: #000; overflow: hidden; z-index: 50;
  transition: opacity .7s ease, transform .7s ease; }
.login.leaving { opacity: 0; transform: scale(1.03); pointer-events: none; }
.login-bg { position: absolute; inset: 0; background-color: #000; background-image: var(--bg-url, none);
  background-size: cover; background-position: 64% center; background-repeat: no-repeat;
  opacity: 0; transition: opacity 1.4s ease; }
.login.ready .login-bg { opacity: 1; }
.login-bg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.30) 0%, rgba(0,0,0,0) 55%); }

.login-stage { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column;
  justify-content: center; align-items: flex-start; gap: clamp(20px, 3.4vh, 34px);
  padding: 0 0 6vh clamp(24px, 3.6vw, 84px); }
.login-logo { width: var(--login-w); height: auto; display: block; user-select: none;
  opacity: 0; transform: translateY(8px); animation: rise .9s .15s ease forwards; }
.login-card { width: min(var(--login-w), 400px); opacity: 0; transform: translateY(8px);
  animation: rise .9s .35s ease forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

.fields { position: relative; border-radius: 16px; overflow: hidden;
  background: rgba(255, 255, 255, 0.10); border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(28px) saturate(160%); backdrop-filter: blur(28px) saturate(160%);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .38); transition: border-color .2s; }
.fields:focus-within { border-color: rgba(255, 255, 255, 0.38); }
.fields input { display: block; width: 100%; padding: 16px 62px 16px 18px; background: transparent;
  border: 0; outline: 0; color: #fff; font-size: 16px; letter-spacing: .01em; }
.fields input + input { border-top: 1px solid rgba(255, 255, 255, 0.16); }
.fields input::placeholder { color: rgba(255, 255, 255, 0.55); }
.fields input:-webkit-autofill { -webkit-text-fill-color: #fff; caret-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px rgba(34, 34, 40, .92) inset; }
.login-go { position: absolute; right: 9px; bottom: 9px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .92); color: #111; display: grid; place-items: center;
  transition: transform .15s, background .15s; }
.login-go:hover { background: #fff; transform: scale(1.06); }
.login-go:disabled { opacity: .5; cursor: default; transform: none; }
.remember { display: inline-flex; align-items: center; gap: 8px; margin: 14px 4px 0; font-size: 13px;
  color: rgba(255, 255, 255, .72); cursor: pointer; user-select: none; }
.remember input { accent-color: #fff; width: 15px; height: 15px; margin: 0; }
.login-err { min-height: 20px; margin: 10px 4px 0; font-size: 13px; color: #ff8a80; }
.login-card.shake .fields { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

@media (max-width: 720px) {
  /* 폰: 로고와 로그인 창을 위쪽 검은 우주 영역에 올려서 글씨가 구름 위로 안 겹치게 한다 */
  .login-bg { background-position: 80% center; }
  .login-bg::after { background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.25) 45%, rgba(0,0,0,0) 70%); }
  .login-stage { align-items: center; justify-content: flex-start; padding: 11vh 20px 0; }
  .login-logo { width: min(80vw, 420px); }
  .login-card { width: min(88vw, 400px); }
}

/* =====================================================================
   탐색기 (Finder 느낌)
   ===================================================================== */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr);
  background: var(--bg); color: var(--fg); opacity: 0; transition: opacity .6s ease; }
.app.shown { opacity: 1; }

/* ----- 사이드바 ----- */
.sidebar { display: flex; flex-direction: column; min-width: 0; padding: 16px 10px 12px; overflow: hidden;
  background: var(--sb-bg); -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  backdrop-filter: blur(var(--blur)) saturate(170%); border-right: 1px solid var(--line); z-index: 5; }
.sb-logo { display: block; height: 26px; width: auto; max-width: 100%; margin: 4px 8px 18px;
  object-fit: contain; object-position: left; filter: var(--logo-filter); user-select: none; }
.sb-head { padding: 6px 10px 4px; font-size: 11px; font-weight: 600; color: var(--fg2); letter-spacing: .02em; }
.tree { flex: 1; overflow: auto; margin: 0 -4px; padding: 0 4px; }
.tr-row { display: flex; align-items: center; gap: 2px; height: 30px; padding-right: 6px;
  border-radius: 8px; cursor: default; user-select: none; font-size: 13.5px; }
.tr-row:hover { background: var(--hover); }
.tr-row.cur { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.tr-tw { width: 20px; height: 24px; display: grid; place-items: center; border: 0; background: none;
  color: var(--fg2); padding: 0; flex: none; }
.tr-tw .ic { width: 12px; height: 12px; stroke-width: 2.4; transition: transform .15s; }
.tr-tw.open .ic { transform: rotate(90deg); }
.tr-tw.none { visibility: hidden; }
.tr-ic { width: 20px; height: 18px; display: grid; place-items: center; margin-right: 6px; flex: none; }
.tr-ic .ic-color { width: 19px; height: 16px; }
.tr-ic .ic { color: var(--accent); width: 18px; height: 18px; }
.tr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-foot { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 8px; }
.sb-btn { flex: 1; height: 34px; border: 0; border-radius: 9px; background: var(--field); display: flex;
  align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; color: var(--fg); }
.sb-btn:hover { background: var(--hover); }
.sb-btn .ic { width: 17px; height: 17px; }

/* ----- 메인 ----- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.toolbar { display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 8px 14px; flex-wrap: wrap;
  background: var(--tb-bg); -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  backdrop-filter: blur(var(--blur)) saturate(170%); border-bottom: 1px solid var(--line); }
.tb-group { display: flex; align-items: center; gap: 2px; }
.tb-btn { width: 32px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: transparent; color: var(--fg); }
.tb-btn:hover { background: var(--hover); }
.tb-btn:disabled { opacity: .35; cursor: default; background: none; }
.tb-btn .ic { width: 19px; height: 19px; }
.tb-menu { display: none; }
.tb-title { font-weight: 600; font-size: 15px; margin: 0 6px; min-width: 0; max-width: 34vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-spacer { flex: 1; min-width: 4px; }
.seg { display: flex; padding: 2px; border-radius: 9px; background: var(--field); }
.seg button { width: 34px; height: 26px; border: 0; border-radius: 7px; background: transparent;
  display: grid; place-items: center; color: var(--fg2); }
.seg button.on { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.seg .ic { width: 17px; height: 17px; }
.tb-select { height: 30px; padding: 0 26px 0 10px; border: 0; border-radius: 8px; background: var(--field);
  color: var(--fg); font-size: 13px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg2) 50%),
                    linear-gradient(135deg, var(--fg2) 50%, transparent 50%);
  background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px; background-size: 5px 5px; background-repeat: no-repeat; }
.tb-select option { color: #000; }
.tb-range { width: 90px; accent-color: var(--accent); }
.tb-search { position: relative; display: flex; align-items: center; }
.tb-search .ic { position: absolute; left: 9px; width: 15px; height: 15px; color: var(--fg2); pointer-events: none; }
.tb-search input { width: 170px; height: 30px; padding: 0 10px 0 30px; border: 0; border-radius: 9px;
  background: var(--field); outline: 0; font-size: 13px; transition: width .2s, box-shadow .2s; }
.tb-search input:focus { width: 230px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.tb-dl { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 8px;
  background: var(--field); font-size: 13px; }
.tb-dl:hover { background: var(--hover); }
.tb-dl .ic { width: 16px; height: 16px; }

.content { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 24px; outline: 0; position: relative; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--fg2); font-size: 14px;
  pointer-events: none; text-align: center; padding: 20px; line-height: 1.6; }

/* ----- 아이콘 보기 ----- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--tile) + 16px), 1fr));
  gap: 6px 4px; align-content: start; }
.tile { display: flex; flex-direction: column; align-items: center; padding: 8px 4px 6px; border-radius: 10px;
  user-select: none; -webkit-user-select: none; cursor: default; min-width: 0; }
.tile .thumb { width: var(--tile); height: var(--tile); display: flex; align-items: center; justify-content: center;
  border-radius: 10px; position: relative; }
.tile.sel .thumb { background: color-mix(in srgb, var(--fg) 14%, transparent); }
.tile .thumb img.photo { max-width: calc(100% - 8px); max-height: calc(100% - 8px); width: auto; height: auto;
  border-radius: 3px; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .45)); background: var(--panel); }
.tile .thumb .ic-color.folder { width: 84%; height: auto; }
.tile .thumb .docico { position: relative; width: 52%; }
.tile .thumb .docico .ic-color { width: 100%; height: auto; display: block; filter: drop-shadow(0 1px 3px rgba(0,0,0,.35)); }
.tile .thumb .docico .ext { position: absolute; left: 0; right: 0; bottom: 14%; text-align: center; font-size: 10px;
  font-weight: 700; color: #6b7280; letter-spacing: .04em; text-transform: uppercase; }
.tile .thumb .playbadge { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: flex;
  align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; }
.tile .thumb .vidico { width: 70%; }
.tile .thumb .vidico .ic-color { width: 100%; height: auto; display: block; border-radius: 6px; }
.tile .name { margin-top: 6px; max-width: 100%; padding: 1px 7px; border-radius: 6px; font-size: 12px; line-height: 1.3;
  text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-all; }
.tile.sel .name { background: var(--accent); color: #fff; }

/* ----- 목록 보기 ----- */
.lhead, .lrow { display: grid; grid-template-columns: minmax(0, 1fr) 210px 90px 140px; align-items: center; padding: 0 12px; }
.lhead { position: sticky; top: -14px; z-index: 2; height: 30px; margin: -14px -16px 4px; padding: 0 28px;
  background: var(--tb-bg); -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--line); font-size: 12px; color: var(--fg2); user-select: none; }
.lhead span { cursor: pointer; padding: 6px 0; }
.lhead span:hover { color: var(--fg); }
.lhead .arr { margin-left: 4px; font-size: 10px; }
.lrow { height: 30px; font-size: 13px; border-radius: 7px; user-select: none; -webkit-user-select: none; cursor: default; }
.lrow:nth-child(odd) { background: var(--stripe); }
.lrow .c-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.lrow .c-name .ico { width: 24px; height: 22px; display: grid; place-items: center; flex: none; }
.lrow .c-name .ico .ic-color { width: 22px; height: 18px; }
.lrow .c-name .ico img { max-width: 24px; max-height: 22px; border-radius: 2px; }
.lrow .c-name span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .c-dim { color: var(--fg2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow.sel { background: var(--accent); color: #fff; }
.lrow.sel .c-dim { color: rgba(255, 255, 255, .85); }

/* ----- 하단 상태/경로 바 ----- */
.statusbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px;
  padding: 4px 14px; border-top: 1px solid var(--line); background: var(--tb-bg); font-size: 12px; color: var(--fg2); }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs button { border: 0; background: none; padding: 3px 6px; border-radius: 6px; color: var(--fg2); font-size: 12px; }
.crumbs button:hover { background: var(--hover); color: var(--fg); }
.crumbs .ic { width: 10px; height: 10px; stroke-width: 2.4; opacity: .6; }
.crumbs .last { color: var(--fg); }
.stat-r { white-space: nowrap; }

/* ----- 우클릭 메뉴 ----- */
.ctx { position: fixed; z-index: 80; min-width: 190px; padding: 5px; border-radius: 10px; background: var(--menu-bg);
  -webkit-backdrop-filter: blur(30px) saturate(170%); backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid var(--line); box-shadow: var(--shadow); }
.ctx button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px;
  background: none; text-align: left; font-size: 13px; }
.ctx button:hover { background: var(--accent); color: #fff; }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.ctx .ic { width: 16px; height: 16px; }

/* ----- 퀵룩(스페이스바 미리보기) ----- */
.ql { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: rgba(0, 0, 0, .78);
  -webkit-backdrop-filter: blur(30px) saturate(150%); backdrop-filter: blur(30px) saturate(150%);
  animation: qlin .18s ease; color: #fff; }
@keyframes qlin { from { opacity: 0; } to { opacity: 1; } }
.ql-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.ql-title { flex: 1; min-width: 0; text-align: center; font-size: 14px; font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.ql-title small { display: block; font-weight: 400; font-size: 11.5px; color: rgba(255,255,255,.6); margin-top: 1px; }
.ql-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff; }
.ql-btn:hover { background: rgba(255, 255, 255, .24); }
.ql-stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; padding: 0 64px 28px;
  touch-action: pan-y; }
.ql-stage img, .ql-stage video { max-width: 100%; max-height: 100%; border-radius: 6px; background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6); user-select: none; -webkit-user-drag: none; }
.ql-stage img { opacity: 0; transition: opacity .25s; }
.ql-stage img.ok { opacity: 1; }
.ql-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: rgba(255,255,255,.75);
  font-size: 14px; line-height: 1.7; pointer-events: none; padding: 0 20px; }
.ql-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; }
.ql-nav:hover { background: rgba(255, 255, 255, .26); }
.ql-nav.prev { left: 10px; }
.ql-nav.next { right: 10px; }
.ql-nav:disabled { opacity: .25; cursor: default; }
.ql-nav .ic { width: 24px; height: 24px; }

/* ----- 토스트 ----- */
.toast { position: fixed; left: 50%; bottom: 52px; transform: translateX(-50%); z-index: 90; padding: 10px 16px;
  border-radius: 999px; background: rgba(30, 30, 34, .92); color: #fff; font-size: 13px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }

/* ----- 스크롤바 ----- */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--fg) 28%, transparent) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--fg) 25%, transparent); border-radius: 8px;
  border: 2px solid transparent; background-clip: padding-box; }

/* ===== 좁은 화면(폰) ===== */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(80vw, 300px); transform: translateX(-102%);
    transition: transform .28s ease; box-shadow: var(--shadow); }
  body.sb-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 4; background: rgba(0,0,0,.45); display: none; }
  body.sb-open .scrim { display: block; }
  .tb-menu { display: grid; }
  .tb-fwd, .tb-range-wrap { display: none; }
  .tb-title { max-width: 40vw; }
  .tb-search input, .tb-search input:focus { width: 120px; }
  .lhead, .lrow { grid-template-columns: minmax(0, 1fr) 80px; }
  .lhead span:nth-child(2), .lhead span:nth-child(4), .lrow .c-date, .lrow .c-kind { display: none; }
  .tb-dl span { display: none; }
  .tb-dl { padding: 0 9px; }
}
