/* mainpage.css — Gerber Eyes 업로드/랜딩 (Figma 0616 재구현, vanilla 외부 CSS).
   다크 상업 테마. Figma 1920 절대좌표 → 반응형 grid/flex. 색=Figma 토큰. */

/* 로컬 Noto Sans KR (디자이너 제공 variable font). 시스템 설치 불필요 = @font-face만. */
@font-face {
  font-family: 'Noto Sans KR';
  src: url('../font/Noto_Sans_KR/NotoSansKR-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #101519;
  --panel: #252A31;
  --panel-2: #1B2026;
  --search-bg: #151A23;
  --border: #8b8b8b;
  --line: #3F4651;
  --text: #E4E6EA;
  --text-dim: #8F94A2;
  --text-dim2: #B2B4C3;
  --blue: #0E6EFD;
  --blue-2: #1E87FF;
  --cyan: #53DDFC;
  --green-2: #30B58F;
  --red: #F52E44;
  --orange: #F58B2E;
  --radius: 12px;
  --sidebar-l: 324px;
  --sidebar-r: 362px;   /* 패널 350 + 우측 갭 12 */
  --font: 'Noto Sans KR', 'Segoe UI', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  height: 100vh;
  overflow: hidden;
}

/* 스크롤바 숨김 (스크롤 기능은 유지) */
.content, .sidebar-right, .file-list { scrollbar-width: none; -ms-overflow-style: none; }
.content::-webkit-scrollbar, .sidebar-right::-webkit-scrollbar, .file-list::-webkit-scrollbar { width: 0; height: 0; display: none; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-l) 1fr var(--sidebar-r);  /* B fluid: 사이드바 고정 + 중앙 채움 */
  height: 100vh;
  position: relative;   /* topnav absolute 기준 */
}

/* ===== LEFT SIDEBAR (최근 파일) ===== */
.sidebar-left {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  overflow: hidden;
}
.brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.brand-logo { width: 184px; height: 48px; object-fit: cover; object-position: center 52%; }  /* Logo.png 정사각+여백 → crop 키움. ★ tight 가로 에셋 권장 */
.user-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--line); }

.search { position: relative; margin-bottom: 24px; }
.search input {
  width: 100%; height: 32px;
  background: var(--search-bg); border: none; border-radius: 20px;
  color: var(--text); font-size: 12px; padding: 0 16px 0 36px; font-family: var(--font);
}
.search input::placeholder { color: var(--text-dim2); }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; opacity: 0.6; }

.recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.recent-title { color: var(--text-dim); font-size: 13px; font-weight: 700; }
.recent-clear-all { background: none; border: none; color: var(--text-dim); font-size: 11px; cursor: pointer; padding: 2px 4px; display: none; }  /* 일단 숨김 (오너 요청, 복구 = display 제거) */
.recent-clear-all:hover { color: var(--red); }
.file-thumb { background-size: contain; background-position: center; background-repeat: no-repeat; }  /* 썸네일 = recent_boards.js 가 inline url. contain = SVG 전체 보임 */

.file-list { list-style: none; overflow-y: auto; flex: 1; }
/* Figma file01 = 세로 카드 (파일명 → 미리보기 박스 → 날짜·시간·크기). 미리보기 클릭=불러오기. */
.file-card {
  position: relative;
  background: rgba(246, 246, 248, 0.05);
  border: 1px solid #37393E;
  border-radius: 8px;
  padding: 12px 14px 12px;
  margin-bottom: 12px;
}
.file-name {
  color: #fff; font-size: 13px; font-weight: 500; line-height: 1.4; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-all;   /* ★ 6/25: 언더스코어 긴 파일명 = 줄바꿈 지점 없어 1줄 잘림 → break-all 로 2줄 clamp 작동 */
  padding: 0 17px; box-sizing: border-box;   /* 좌우 24 = X버튼 침범 방지 + 중앙 균형 */
}
.file-thumb {
  width: 100%; aspect-ratio: 176 / 116; margin: 10px 0;
  background-color: #F6F6F8; border-radius: 6px; cursor: pointer;
}
.file-thumb:hover { outline: 1px solid var(--accent); outline-offset: -1px; }
.file-sub { display: flex; align-items: center; justify-content: center; gap: 8px; color: #B2B4C3; font-size: 12px; }
.file-size { position: relative; padding-left: 10px; }
.file-size::before {   /* Figma Ellipse9 = 시간·크기 사이 점 */
  content: ''; position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 2px; border-radius: 50%; background: #B2B4C3;
}
.file-x { position: absolute; right: 12px; top: 12px; color: #8F94A2; cursor: pointer; background: none; border: none; font-size: 13px; z-index: 2; }
.file-x img { width: 20px; height: 20px; display: block; }   /* ★ 6/25: X 글자 → Trash.png 아이콘 */
/* 삭제 2단계 = X 클릭 → "✕ Delete?" 확인 버튼 (흰 배경 + 빨강, Figma 42). 누르면 실제 삭제. */
.file-delete-confirm {
  position: absolute; top: 10px; right: 0; display: none;
  align-items: center; gap: 6px;
  background: #fff; color: var(--red);
  border: none; border-radius: 8px; padding: 6px 12px;
  font-size: 13px; font-weight: 700; font-family: var(--font);
  cursor: pointer; white-space: nowrap; z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.file-card.confirming .file-x { display: none; }
.file-card.confirming .file-delete-confirm { display: inline-flex; }
/* hover 시 전체 파일명 툴팁 = position:fixed (사이드바/리스트 overflow 무관 = 항상 최상위). JS가 좌표·텍스트 설정. */
.filename-tooltip {
  position: fixed; z-index: 9999;
  background: #0B0D10; color: #fff;
  padding: 8px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 500; white-space: nowrap; max-width: 60vw;
  overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
  opacity: 0; visibility: hidden; transition: opacity 0.12s;
  pointer-events: none;
}
.filename-tooltip.show { opacity: 1; visibility: visible; }
.file-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 4px 6px; border-radius: 4px; margin-top: 6px; }
.file-tag.order { color: var(--blue-2); background: rgba(72, 113, 189, 0.30); }
.file-tag.reorder { color: var(--green-2); background: rgba(72, 160, 189, 0.30); }
.file-tag.review { color: var(--red); background: rgba(189, 72, 72, 0.30); }
.file-empty { color: var(--text-dim); font-size: 13px; padding: 28px 4px; text-align: center; line-height: 1.5; }  /* 빈 상태 (웹DB 전) */
.file-card.search-hidden { display: none; }   /* 검색 필터 = 카드 숨김 (재생성 X = object URL 누수 방지) */
.search-empty { padding: 14px 4px; color: var(--text-dim2); }   /* 검색 결과 없음 */

/* ===== CENTER (업로드) ===== */
.content { display: flex; flex-direction: column; align-items: center; justify-content:space-around; padding: 20px; padding-bottom: 210px; }  /* B fluid: 세로 가운데 (높이 가변이라 가운데가 안정적) */
.center-scale { display: flex; flex-direction: column; align-items: center; transform: scale(0.85); transform-origin: center center; }  /* ★ 중앙 고정 배율 — 크기 조정 시 이 0.65 숫자만 변경 (창 무관 동일) */
.topnav { position: absolute; top: 18px; right: 24px; display: flex; gap: 12px; align-items: center; z-index: 20; }  /* .app(1920) 기준 = 같이 scale */
.nav-btn {
  display: inline-flex; align-items: center; gap: 1px;
  background: var(--panel-2); color: var(--text);
  font-size: 13px; font-weight: 500; padding: 7px 12px; border-radius: 8px; cursor: pointer; text-decoration: none;
}
.nav-btn.star { color: #FFD166; }
.nav-btn.text { color: #ffffff; }
.nav-btn.img { width: 16px; height: 16px; }
.nav-btn.svg { display: block; }
.nav-btn.icon-only { padding: 6px; }
.nav-btn:hover { background-color: var(--panel); }

/* 제작규격 팝업 (Figma #47 = 버튼 아래 ▲화살표 드롭다운). JS(spec_popup.js)가 위치/화살표 설정. */
.spec-pop {
  position: fixed; width: 320px; z-index: 200;
  background: #1A1F27; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  padding-bottom: 8px;
}
.spec-pop-arrow {
  position: absolute; top: -7px; width: 16px; height: 16px;
  background: #1A1F27; transform: rotate(45deg); border-radius: 3px;
}
.spec-pop-title {
  color: #8B92A0; font-size: 14px; font-weight: 700;
  padding: 16px 22px 13px; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.spec-pop-body { padding: 6px 0; max-height: 62vh; overflow-y: auto; }
.spec-pop-row {
  display: flex; justify-content: space-between; align-items: center; padding: 9px 22px;
}
.spec-pop-label { color: #9CA3AF; font-size: 14px; }
.spec-pop-value { color: #fff; font-size: 14px; font-weight: 700; }

.mode-toggle { display: inline-flex; width: 208px; height: 42px; background: #2D3A4D; border-radius: 50px; margin: 0 0 120px; }  /* Figma 208x42 @y131, toggle→group gap 81 → group y254 */
.mode-toggle button {
  flex: 1; border: none; background: transparent; color: #fff; font-size: 16px; font-weight: 500;
  line-height: 42px; border-radius: 50px; cursor: pointer; font-family: var(--font);
}
.mode-toggle button.active { background: var(--blue); font-weight: 700; }

.hero { margin-bottom: 35px; display: flex; align-items: center; gap: 12px; }  /* GerberEyes 334x56 + 셋 합쳐 569 위한 gap */
.hero img { height: 56px; }

.dropzone {
  width: 100%; min-width: 640px; min-height: 372px;   /* Figma 640x372 (hug) */
  border: 4px dashed var(--blue); border-radius: var(--radius);
  background: rgba(14, 110, 253, 0.06);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s, border-color 0.2s; padding: 32px; text-align: center;
}
.dropzone:hover, .dropzone.dragover { background: rgba(14, 110, 253, 0.12); border-color: var(--blue-2); }
.dropzone .folder-icon { width: 110px; height: 110px; object-fit: contain; margin-bottom: 18px; }  /* Figma 110x110 중앙 */
.dropzone h1 { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
.dropzone p { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }
.dropzone input[type="file"] { display: none; }
.btn-select {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue); color: #fff; border: none; padding: 12px 28px; border-radius: 8px;
  font-size: 14px; font-weight: 700; cursor: pointer; font-family: var(--font);
}
.btn-select:hover { background: var(--blue-2); }
.btn-select img { width: 16px; }

.dfm-check { display: inline-flex; align-items: center; gap: 8px; margin-top: 35px; color: rgb(86, 121, 161); font-size: 16px; font-weight: 700; cursor: pointer; user-select: none; }  /* Figma rgb(86,121,161) */
/* 흰 배경 + 파란 체크 (Figma 38). native accent-color = 파란배경+흰체크라 반대 → custom. */
.dfm-check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  width: 22px; height: 22px; flex-shrink: 0;
  background: #fff; border: 1px solid #C8CCD4; border-radius: 5px;
  cursor: pointer; position: relative;
}
.dfm-check input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 7px; top: 3px;
  width: 5px; height: 10px;
  border: solid var(--blue); border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);   /* V 체크마크 */
}
.dfm-note { color: var(--text-dim); font-size: 15px; margin-top: 10px; }

/* ★ 6/25: progress bar = css/progress_bar.css + js/common/progress_bar.js 모듈로 이관 (재사용). */

/* ===== RIGHT SIDEBAR (프로모) ===== */
.sidebar-right { background: var(--panel); margin: 70px 12px 12px 0; border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }  /* Figma 350x998 */
.promo-card { display: flex; justify-content: center; text-decoration: none; }  /* 이미지 자체에 텍스트 = 이미지만 */
.promo-card img { width: 310px; height: 141px; object-fit: cover; border-radius: var(--radius); display: block; }  /* Figma 310x141 */
.promo-card.ad img { height: auto; }  /* KORLINX 세로 카드(572x680) = 폭 310 맞춤 + 비율 유지 */
.promo-tag { font-size: 11px; font-weight: 700; }
.promo-tag.free { color: var(--blue-2); }
.promo-tag.new { color: #E95E49; }
.promo-card h3 { color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.5; margin-top: 6px; max-width: 60%; }
.promo-badge { position: absolute; top: 14px; right: 14px; font-size: 10px; font-weight: 700; }
.promo-badge.free { color: var(--blue-2); }
.promo-badge.new { color: var(--red); }
.promo-thumb { position: absolute; bottom: 14px; right: 14px; width: 64px; }

/* ===== 반응형 (사이드바 합 686 + 중앙 최소 → breakpoint 낮춤. 노트북 정상폭=항상 3열) ===== */
@media (max-width: 760px) {   /* 창을 절반 이하로 줄였을 때만 우측 숨김 (공간 부족) */
  .app { grid-template-columns: var(--sidebar-l) 1fr; }
  .sidebar-right { display: none; }
}
@media (max-width: 520px) {   /* 모바일 폭 = 좌측도 숨김 */
  .app { grid-template-columns: 1fr; }
  .sidebar-left { display: none; }
}
