/* auth.css - HyperFrames Auth Page */

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

:root {
  --bg-base:        #050812;
  --bg-card:        rgba(255,255,255,0.04);
  --bg-card-hover:  rgba(255,255,255,0.07);
  --border:         rgba(255,255,255,0.08);
  --border-hover:   rgba(255,255,255,0.18);
  --text-primary:   #f0f2ff;
  --text-secondary: #8b8fa8;
  --text-muted:     #4b4f6a;
  --accent-from:    #6366f1;
  --accent-to:      #8b5cf6;
  --accent-mid:     #7c5ff3;
  --danger:         #ef4444;
  --success:        #22c55e;
  --warning:        #f59e0b;
  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      20px;
  --radius-xl:      28px;
  --shadow-glow:    0 0 40px rgba(99,102,241,0.18);
  --shadow-card:    0 8px 32px rgba(0,0,0,0.45);
  --transition:     all 0.22s cubic-bezier(0.4,0,0.2,1);
}

html, body {
  min-height: 100vh;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  overflow-x: hidden;
}

/* Animated background */
.bg-canvas {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(99,102,241,0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(139,92,246,0.06) 0%, transparent 50%),
    radial-gradient(circle at 60% 80%, rgba(59,130,246,0.04) 0%, transparent 50%);
}
.orb {
  position: absolute; border-radius: 50%; filter: blur(80px);
  animation: orbFloat 8s ease-in-out infinite alternate;
}
.orb-1 { width: 600px; height: 600px; top: -200px; left: -200px; background: radial-gradient(circle, #6366f1 0%, transparent 70%); opacity: 0.12; animation-delay: 0s; }
.orb-2 { width: 500px; height: 500px; bottom: -150px; right: -150px; background: radial-gradient(circle, #8b5cf6 0%, transparent 70%); opacity: 0.1; animation-delay: -3s; }
.orb-3 { width: 400px; height: 400px; top: 50%; left: 50%; transform: translate(-50%,-50%); background: radial-gradient(circle, #3b82f6 0%, transparent 70%); opacity: 0.06; animation-delay: -6s; }
@keyframes orbFloat { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(30px, 20px) scale(1.1); } }
.orb-3 { animation-name: orbFloat3; }
@keyframes orbFloat3 { 0% { transform: translate(-50%,-50%) scale(1); } 100% { transform: translate(calc(-50% + 20px), calc(-50% + 15px)) scale(1.08); } }

/* Page layout */
.page {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.hidden { display: none !important; }
/* Custom Modal Widths */
#newProjectModal .modal-card {
  max-width: 800px;
}
/* === AUTH PAGE === */
#authPage {
  flex: 1; display: flex;
  align-items: center; justify-content: center;
  padding: 40px 20px;
}
#authSection {
  width: 100%; max-width: 440px;
}
.auth-logo {
  text-align: center; margin-bottom: 40px;
}
.auth-logo-icon {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; box-shadow: 0 8px 32px rgba(99,102,241,0.4);
}
.auth-logo h1 {
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.auth-card {
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}
.auth-tabs {
  display: flex; background: rgba(255,255,255,0.04);
  border-radius: var(--radius-md); padding: 4px;
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1; padding: 10px 16px; border: none; background: none;
  color: var(--text-muted); font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition); font-family: inherit;
}
.auth-tab.active {
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: white; box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 8px; letter-spacing: 0.5px;
  text-transform: uppercase;
}
.form-input {
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 14px; font-family: inherit;
  outline: none; transition: var(--transition);
}
.form-input:focus { border-color: var(--accent-from); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-input::placeholder { color: var(--text-muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border: none; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: var(--transition); white-space: nowrap;
}
.btn-primary {
  width: 100%; background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: white; box-shadow: 0 4px 16px rgba(99,102,241,0.3);
  margin-top: 8px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(99,102,241,0.4); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-success { background: var(--success); color: white; }
.btn-danger  { background: var(--danger);  color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.auth-footer a { color: var(--accent-from); cursor: pointer; font-weight: 600; }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.alert-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.12);  border: 1px solid rgba(34,197,94,0.3);  color: #86efac; }
.alert-info    { background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.3); color: #a5b4fc; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* === PENDING PAGE === */
#pendingPage {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center;
}
.pending-card {
  max-width: 420px; padding: 48px 40px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); backdrop-filter: blur(20px);
}
.pending-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--warning); margin: 0 auto 24px;
}
.pending-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 12px; }
.pending-card p  { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

/* === PROJECT PAGE === */
#projectPage { flex: 1; display: flex; flex-direction: column; }
.topbar {
  height: 60px; padding: 0 24px;
  background: rgba(5,8,18,0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topbar-logo-icon {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.topbar-logo-text { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.topbar-tabs { display: flex; gap: 4px; margin-left: 24px; }
.topbar-tab {
  padding: 6px 16px; border: none; background: transparent;
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  border-radius: var(--radius-sm); cursor: pointer;
  font-family: inherit; transition: var(--transition); position: relative;
}
.topbar-tab.active { color: var(--text-primary); background: rgba(255,255,255,0.07); }
.topbar-spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 6px 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 100px; cursor: pointer; transition: var(--transition);
}
.user-chip:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.user-name   { font-size: 13px; font-weight: 600; }
.user-level-badge {
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 100px; background: rgba(99,102,241,0.2);
  color: var(--accent-from); letter-spacing: 0.5px;
}
.badge-dot {
  min-width: 18px; height: 18px; border-radius: 100px;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; position: absolute; top: -4px; right: -4px;
}

/* Project page content */
.page-content { flex: 1; padding: 32px 24px; max-width: 1200px; margin: 0 auto; width: 100%; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.page-title { font-size: 22px; font-weight: 800; }
.page-count { font-size: 13px; color: var(--text-muted); }
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.project-card-new {
  aspect-ratio: 1/1; border-radius: var(--radius-lg);
  border: 2px dashed var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; cursor: pointer; transition: var(--transition);
  color: var(--text-muted); font-size: 14px; font-weight: 600;
}
.project-card-new:hover { border-color: var(--accent-from); color: var(--accent-from); background: rgba(99,102,241,0.04); transform: translateY(-2px); }
.project-card-new i { font-size: 32px; }
.project-card {
  border-radius: var(--radius-lg); overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border);
  cursor: pointer; transition: var(--transition);
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); border-color: var(--border-hover); }
.project-thumbnail {
  aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: rgba(255,255,255,0.2); position: relative; overflow: hidden;
  background: #0a0d1a;
}
.project-thumbnail-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.4) 100%);
}
.project-info { padding: 14px 16px; }
.project-name { font-size: 14px; font-weight: 700; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-meta { display: flex; align-items: center; justify-content: space-between; }
.project-date { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.project-template-badge {
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 100px; background: rgba(99,102,241,0.15); color: var(--accent-from);
}
.empty-state {
  grid-column: 1/-1; text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.empty-state span { font-size: 13px; }

/* Template thumbnails */
.tmpl-1  { background: linear-gradient(135deg, #0a1628, #1a2a4a); }
.tmpl-2  { background: linear-gradient(135deg, #061835, #0f3460); }
.tmpl-3  { background: linear-gradient(135deg, #d1d5e8, #f0f2f8); }
.tmpl-4  { background: linear-gradient(135deg, #080808, #1a1a1a); }
.tmpl-5  { background: linear-gradient(135deg, #4c1d95, #7c3aed, #a855f7); }
.tmpl-6  { background: linear-gradient(135deg, #042f2e, #0f766e, #14b8a6); }
.tmpl-7  { background: linear-gradient(135deg, #431407, #9a3412, #ea580c); }
.tmpl-8  { background: linear-gradient(135deg, #082f49, #0369a1, #e0f2fe); }
.tmpl-9  { background: linear-gradient(135deg, #831843, #db2777, #f59e0b, #10b981); }
.tmpl-10 { background: linear-gradient(135deg, #1e1b4b, #312e81, #b45309); }

/* Admin panel */
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.section-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.section-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 10px 16px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13px; vertical-align: middle; }
.admin-table tr:hover td { background: var(--bg-card); }
.level-badge { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 700; }
.level-1 { background: rgba(245,158,11,0.15); color: var(--warning); }
.level-2 { background: rgba(34,197,94,0.15);  color: var(--success); }
.level-3 { background: rgba(99,102,241,0.15); color: var(--accent-from); }
.action-btns { display: flex; gap: 8px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  width: 100%; max-width: 520px; max-height: 80vh; overflow-y: auto;
  background: #0c0f1e; border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-size: 18px; font-weight: 800; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.modal-close:hover { color: var(--text-primary); }
.project-name-input {
  width: 100%; padding: 14px 16px; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 16px; font-family: inherit; outline: none;
  transition: var(--transition);
}
.project-name-input:focus { border-color: var(--accent-from); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.template-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 20px 0 12px; }
.template-grid { 
  display: grid; 
  grid-template-columns: repeat(5, 1fr); 
  gap: 12px; 
  margin-bottom: 24px; 
  max-height: 380px; 
  overflow-y: auto;
  padding-right: 4px;
}
/* 스크롤바 디자인 (웹킷) */
.template-grid::-webkit-scrollbar { width: 6px; }
.template-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.template-grid::-webkit-scrollbar-track { background: transparent; }

.template-card {
  border-radius: var(--radius-md); overflow: hidden; cursor: pointer;
  border: 2px solid transparent; transition: var(--transition);
  position: relative;
}
.template-card:hover  { border-color: var(--border-hover); transform: translateY(-2px); }
.template-card.selected { border-color: var(--accent-from); box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }
.template-thumb {
  aspect-ratio: 1/1;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 8px;
  background-size: cover !important;
  background-position: center !important;
  position: relative;
  overflow: hidden;
  background-color: #0a0d1a;
}

/* 관리자용 템플릿 삭제 버튼 */
.template-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
  opacity: 0;
}
.template-card:hover .template-delete-btn {
  opacity: 1;
}
.template-delete-btn:hover {
  background: #ef4444;
  color: #fff;
}
.template-name { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.9); line-height: 1.2; }
.btn-create {
  width: 100%; padding: 14px; background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  border: none; border-radius: var(--radius-md); color: white;
  font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: var(--transition);
}
.btn-create:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(99,102,241,0.4); }

/* Topbar logout btn */
.btn-logout {
  padding: 6px 14px; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm); color: #fca5a5; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.4); }

/* Toast */
#toastContainer { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 14px 18px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s ease;
  backdrop-filter: blur(12px); box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.success { background: rgba(34,197,94,0.15);  border: 1px solid rgba(34,197,94,0.3);  color: #86efac; }
.toast.error   { background: rgba(239,68,68,0.15);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.toast.info    { background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3); color: #a5b4fc; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(8px); } }

/* ── 썸네일 내부 요소 공통 스타일 (auth.html은 styles.css 미로드) ── */
.text-element-inner {
  width: 100%; height: 100%;
  word-wrap: break-word; white-space: pre-wrap; display: flex;
  box-sizing: border-box; overflow: hidden;
}
.shape-element-inner {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.image-element-inner {
  width: 100%; height: 100%;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.icon-element-inner {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.icon-element-inner i { line-height: 1; }
.table-element-inner {
  width: 100%; height: 100%;
  border-collapse: collapse; overflow: hidden; table-layout: fixed;
}
.table-element-inner th, .table-element-inner td {
  padding: 4px; text-align: center; font-size: 10px;
  border: 1px solid rgba(255,255,255,0.1); vertical-align: middle;
  word-break: break-word; overflow: hidden;
}
.chart-element-inner { width: 100%; height: 100%; overflow: hidden; }
