/* ============================================
   ROOT & BASE STYLES
   ============================================ */

:root {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, sans-serif;
}

body {
  margin: 0;
  background: #0b0d10;
  color: #e6edf3;
  min-height: 100vh;
}


/* ============================================
   LAYOUT
   ============================================ */

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 16px;
}


/* ============================================
   TYPOGRAPHY
   ============================================ */

h1 {
  font-size: 1.5rem;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.subtitle {
  color: #8b949e;
  margin-bottom: 24px;
  font-size: 0.95rem;
}


/* ============================================
   CARD COMPONENT
   ============================================ */

.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 24px;
}


/* ============================================
   SECTION COMPONENT
   ============================================ */

.section {
  margin-bottom: 28px;
}

.section:last-of-type {
  margin-bottom: 0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 16px;
  color: #e6edf3;
}

.section-desc {
  margin: 0 0 12px;
  color: #8b949e;
  font-size: 0.9rem;
}


/* ============================================
   FORM CONTROLS
   ============================================ */

.form-group {
  margin-bottom: 12px;
  position: relative;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #8b949e;
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 0.95rem;
  font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #2563eb;
}

input[type="text"]::placeholder {
  color: #6e7681;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-hint {
  position: absolute;
  right: 12px;
  top: calc(0.85rem + 6px + 24px);
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: #6e7681;
  pointer-events: none;
}


/* ============================================
   BUTTONS
   ============================================ */

button {
  font-size: 0.95rem;
  border-radius: 8px;
  padding: 10px 14px;
  border: none;
  cursor: pointer;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  width: 100%;
  transition: background 0.15s;
}

button:hover:not(:disabled) {
  background: #1d4ed8;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: #30363d;
}

button.secondary:hover:not(:disabled) {
  background: #3d444d;
}

button.connected {
  background: #22c55e;
}

button.connected:hover:not(:disabled) {
  background: #16a34a;
}

button.btn-upload {
  padding: 16px 24px;
  font-size: 1.1rem;
}


/* ============================================
   DEVICE IMAGE
   ============================================ */

.device-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid #30363d;
}


/* ============================================
   PROGRESS BAR
   ============================================ */

.progress-wrap {
  margin-top: 20px;
  display: none;
}

.progress-wrap.visible {
  display: block;
}

progress {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #21262d;
  border: none;
}

progress::-webkit-progress-bar {
  background: #21262d;
  border-radius: 4px;
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  border-radius: 4px;
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  border-radius: 4px;
}


/* ============================================
   STATUS MESSAGES
   ============================================ */

.status {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  display: none;
}

.status.visible {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status.info {
  background: #161b22;
  border: 1px solid #30363d;
  color: #8b949e;
}

.status.success {
  background: #0d1117;
  border: 1px solid #22c55e;
  color: #4ade80;
}

.status.error {
  background: #0d1117;
  border: 1px solid #dc2626;
  color: #f87171;
}

.status.waiting {
  background: #0d1117;
  border: 1px solid #9e6a03;
  color: #d29922;
}


/* ============================================
   HELP SECTION
   ============================================ */

.help {
  margin-top: 20px;
  font-size: 0.85rem;
  color: #8b949e;
  line-height: 1.6;
}

.help strong {
  color: #e6edf3;
}

.help a {
  color: #58a6ff;
  text-decoration: none;
}

.help a:hover {
  text-decoration: underline;
}


/* ============================================
   FOOTER
   ============================================ */

.footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #21262d;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #8b949e;
  flex-wrap: wrap;
  gap: 8px;
}

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

.footer a {
  color: #58a6ff;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}


/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    text-align: center;
  }
}
