/* ===== ALLFEAT DESIGN SYSTEM ===== */
/* Inspired by register.allfeat.org */

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

:root {
  /* Primary brand color - Allfeat Teal */
  --color-primary: #1BA794;
  --color-primary-hover: #17957e;
  --color-primary-light: rgba(27, 167, 148, 0.1);
  
  /* Dark theme (default) */
  --bg-primary: #0A0A0A;
  --bg-secondary: #111111;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.05);
  --border-color: #262626;
  --border-color-hover: #333333;
  --text-primary: #FAFAFA;
  --text-secondary: #D6D8DC;
  --text-muted: #999999;
  --footer-bg: #0A0A0A;
}

/* Light theme */
[data-theme="light"] {
  --bg-primary: #F5F5F5;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FAFAFA;
  --border-color: #E5E5E5;
  --border-color-hover: #D4D4D4;
  --text-primary: #151515;
  --text-secondary: #525252;
  --text-muted: #737373;
  --footer-bg: #F5F5F5;
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
  /* Support CJK characters properly */
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* Main layout - footer always at bottom */
main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px); /* Account for fixed header */
}

.container {
  flex: 1 0 auto;
}

/* ===== HEADER ===== */
header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 80px;
  transition: background-color 0.3s, border-color 0.3s;
}

/* Add padding to body to account for fixed header */
body {
  padding-top: 80px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo svg {
  height: 28px;
  width: auto;
}

.logo-img {
  height: 40px;
  width: auto;
}

.logo-text {
  font-size: 24px;
  font-weight: bold;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Noto Sans Mono CJK KR', monospace;
  font-size: 14px;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
  white-space: nowrap;
}

/* Language selector - matches register.allfeat.org */
.lang-selector-container {
  position: relative;
}

.lang-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 2.2;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-selector:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.lang-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.lang-icon svg {
  width: 16px;
  height: 16px;
}

.lang-flag {
  font-size: 14px;
}

.lang-text {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif !important;
  font-size: 14px;
  line-height: 2.2;
  white-space: nowrap;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  display: inline-block;
  vertical-align: middle;
  text-combine-upright: none !important;
  font-feature-settings: normal !important;
}

/* Language dropdown menu */
.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px;
  min-width: 200px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 200;
  animation: dropdown-appear 0.15s ease-out;
}

@keyframes dropdown-appear {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  font-size: 14px;
  line-height: 2.2;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.lang-option:hover {
  background: var(--bg-card-hover);
}

.lang-option.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.lang-option .lang-flag {
  font-size: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Toggle - exact match to register.allfeat.org */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
}

.theme-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.theme-icon svg {
  width: 18px;
  height: 18px;
}

/* Active icon (sun in light mode, moon in dark mode) */
.theme-icon.icon-active {
  color: #60A5FA;
}

.theme-switch {
  width: 44px;
  height: 24px;
  background: var(--border-color);
  border-radius: 12px;
  position: relative;
  transition: background 0.3s;
}

/* Switch turns teal when dark mode (checked) */
.theme-switch.checked {
  background: var(--color-primary);
}

.theme-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Knob moves to right when checked (dark mode) */
.theme-switch.checked::after {
  transform: translateX(20px);
}

/* ===== BUTTONS ===== */
.btn {
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--color-primary);
  color: #FAFAFA;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ===== MAIN CONTAINER ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 40px;
}

/* ===== HERO SECTION ===== */
.hero {
  text-align: center;
  margin-bottom: 60px;
}

h1 {
  font-size: 48px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
  transition: all 0.3s;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

/* ===== UPLOAD SECTION ===== */
.upload-section {
  display: block;  /* Important: label should behave as block element */
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
}

.upload-section:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.upload-text {
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.upload-hint {
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== PREVIEW SECTION ===== */
.preview-section {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
  margin-top: 30px;
}

.preview-section.show {
  display: block;
}

.preview-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.preview-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.preview-title {
  font-size: 24px;
  color: var(--color-primary);
}

.preview-list {
  margin: 20px 0;
}

.preview-item {
  padding: 15px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.preview-item:hover {
  border-color: var(--color-primary);
}

.preview-item-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.preview-item-details {
  font-size: 14px;
  color: var(--text-muted);
}

.preview-cost {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== PROGRESS SECTION ===== */
.progress-section {
  display: none;
  margin-top: 30px;
}

.progress-section.show {
  display: block;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  transition: width 0.3s;
}

/* ===== LOGS PANEL ===== */
.logs-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin: 20px 0;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.logs-title {
  font-weight: 600;
  color: var(--text-primary);
}

.logs-clear {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.logs-clear:hover {
  border-color: var(--border-color-hover);
  color: var(--text-primary);
}

.logs-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Noto Sans Mono CJK KR', monospace;
  font-size: 13px;
  line-height: 1.5;
  word-break: keep-all;
}

.log-entry {
  padding: 4px 8px;
  border-radius: 4px;
  margin: 2px 0;
  animation: log-fade-in 0.2s ease-out;
}

@keyframes log-fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.log-info { color: var(--text-muted); }
.log-success { color: #4ADE80; }
.log-warning { color: #FCD34D; background: rgba(252, 211, 77, 0.1); }
.log-error { color: #F87171; background: rgba(248, 113, 113, 0.1); }

.logs-content::-webkit-scrollbar { width: 8px; }
.logs-content::-webkit-scrollbar-track { background: var(--bg-secondary); }
.logs-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.logs-content::-webkit-scrollbar-thumb:hover { background: var(--border-color-hover); }

/* ===== WALLET STATUS - exact match to register.allfeat.org ===== */
.wallet-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: #FFFFFF;
  color: #000000;
  border: 1px solid #E5E5E5;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
}

.wallet-status:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.wallet-status.connected {
  background: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
}

.wallet-icon {
  display: flex;
  align-items: center;
}

.wallet-icon svg {
  width: 18px;
  height: 18px;
}

/* ===== FOOTER ===== */
footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border-color);
  padding: 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
  margin-top: auto;
  transition: background-color 0.3s, border-color 0.3s;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--color-primary);
}

.footer-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.rust-badge {
  color: var(--color-primary);
  font-weight: 600;
}

/* ===== WALLET MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modal-fade-in 0.2s ease-out;
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modal-slide-up 0.3s ease-out;
}

@keyframes modal-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.wallet-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.wallet-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
}

.wallet-option:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.wallet-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
}

.wallet-info {
  flex: 1;
}

.wallet-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.wallet-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

/* ===== UTILS ===== */
.hidden { display: none !important; }
.mt-20 { margin-top: 20px; }
.text-center { text-align: center; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  header {
    padding: 12px 20px;
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .header-right {
    flex-wrap: wrap;
  }
  
  .container {
    padding: 40px 20px;
  }
  
  h1 {
    font-size: 32px;
  }
  
  .subtitle {
    font-size: 16px;
  }
  
  footer {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
}
