/* ============================================
   RESET & TOKENS
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Base */
    --bg: #ffffff;
    --bg-subtle: #f8fafc;
    --bg-hover: #f1f5f9;

    /* Borders */
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    /* Text */
    --text: #0f172a;
    --text-dim: #475569;
    --text-faint: #94a3b8;

    /* Blue accent */
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --blue-soft: #eff6ff;
    --blue-border: #bfdbfe;

    /* Status */
    --green: #16a34a;
    --green-soft: #f0fdf4;
    --red: #dc2626;
    --red-soft: #fef2f2;

    --radius: 12px;
    --radius-sm: 8px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
}

/* ============================================
   BODY
   ============================================ */
html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 16px 24px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.011em;
}

/* Hide the background decoration divs (not needed in light theme) */
.bg-glow, .bg-noise { display: none; }

/* ============================================
   HEADER
   ============================================ */
header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeDown 0.6s ease both;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-subtle);
    font-size: 0.78rem;
    color: var(--text-dim);
    letter-spacing: 0.02em;
    margin-bottom: 22px;
    font-weight: 500;
}

.brand-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--blue);
}

header h1 {
    font-size: clamp(1.9rem, 5vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.1;
    color: var(--text);
}

header h1 em {
    font-style: normal;
    color: var(--blue);
    font-weight: 800;
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-top: 12px;
    font-weight: 500;
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    width: 100%;
    max-width: 580px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   CONNECTION BAR
   ============================================ */
.connection-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    animation: fadeUp 0.6s ease 0.05s both;
}

.connection-bar.connected {
    border-color: #bbf7d0;
    background: var(--green-soft);
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-faint);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.connection-bar.connected .status-dot {
    background: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

#connectionText {
    flex: 1;
    font-size: 0.88rem;
    color: var(--text-dim);
    font-weight: 600;
}

.connection-bar.connected #connectionText { color: var(--text); }

.btn-disconnect {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--red);
    padding: 7px 14px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    width: auto;
    font-family: inherit;
}

.btn-disconnect:hover {
    background: var(--red-soft);
    border-color: #fecaca;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    position: relative;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    box-shadow: var(--shadow-sm);
    animation: fadeUp 0.6s ease both;
}

.card:nth-of-type(1) { animation-delay: 0.1s; }
.card:nth-of-type(2) { animation-delay: 0.16s; }
.card:nth-of-type(3) { animation-delay: 0.22s; }

.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.step-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--text-faint);
    letter-spacing: 0.1em;
    font-weight: 700;
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text);
    margin-bottom: 6px;
}

.hint {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 18px;
    font-weight: 500;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   ID BOX
   ============================================ */
.id-box {
    background: var(--bg-subtle);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
    text-align: center;
    letter-spacing: 0.03em;
    transition: all 0.25s ease;
}

.id-box:hover {
    border-color: var(--blue-border);
    background: var(--blue-soft);
}

/* ============================================
   QR CODE
   ============================================ */
.qr-code {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 18px 0;
    padding: 18px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    min-height: 180px;
}

.qr-code img {
    border-radius: 4px;
    display: block;
}

/* ============================================
   INPUT
   ============================================ */
input[type="text"] {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.92rem;
    outline: none;
    transition: all 0.2s ease;
    margin-bottom: 12px;
    font-family: inherit;
    font-weight: 500;
}

input[type="text"]:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

input[type="text"]::placeholder {
    color: var(--text-faint);
    font-weight: 400;
}

/* ============================================
   BUTTONS
   ============================================ */
button {
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    letter-spacing: -0.005em;
}

.btn-primary {
    background: var(--blue);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--blue-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
    background: var(--bg);
    border: 1.5px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-soft);
}

.button-row {
    display: flex;
    gap: 10px;
}
.button-row button { flex: 1; }

/* ============================================
   DRAG & DROP ZONE
   ============================================ */
.drop-zone {
    position: relative;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: var(--bg-subtle);
}

.drop-zone:hover {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.drop-zone.drag-active {
    border-color: var(--blue);
    border-style: solid;
    background: var(--blue-soft);
    transform: scale(1.01);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.drop-zone.drag-active .drop-icon { color: var(--blue); }
.drop-zone.drag-active .drop-title { color: var(--blue); }

.drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.drop-icon {
    color: var(--text-dim);
    margin-bottom: 12px;
    transition: color 0.25s ease;
}

.drop-zone:hover .drop-icon { color: var(--blue); }

.drop-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    transition: color 0.25s ease;
}

.drop-zone:hover .drop-title { color: var(--blue); }

.drop-sub {
    font-size: 0.82rem;
    color: var(--text-faint);
    font-weight: 500;
}

/* ============================================
   PROGRESS
   ============================================ */
.progress-container {
    width: 100%;
    height: 8px;
    background: var(--bg-hover);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 16px;
    display: none;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--blue);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.progress-text {
    text-align: center;
    color: var(--blue);
    font-size: 0.85rem;
    margin-top: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   STATUS CARD
   ============================================ */
.status-card {
    background: var(--bg-subtle);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
    animation: fadeUp 0.6s ease 0.28s both;
}

#status {
    font-size: 0.88rem;
    color: var(--text-dim);
    font-weight: 600;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    margin-top: auto;
    padding: 40px 20px 8px;
    color: var(--text-faint);
    font-size: 0.8rem;
    text-align: center;
    font-weight: 500;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 520px) {
    body { padding: 28px 12px 16px; }
    header { margin-bottom: 32px; }
    .card { padding: 24px; }
    .id-box { font-size: 0.72rem; }
    .button-row { flex-direction: column; }
    .step-badge { top: 20px; right: 20px; }
}










/* ============================================
   CONNECTION INFO (device name display)
   ============================================ */
.connection-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.connection-sub {
    font-size: 0.75rem;
    color: var(--text-faint);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.connection-bar.connected .connection-sub {
    color: var(--text-dim);
}