@import url('https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap');

/* Extension Setup Page */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; cursor: default; }
input[type="text"], input[type="search"], textarea { cursor: text; }

:root {
    --bg: #f2f2f7; --surface: #ffffff; --surface2: #f2f2f7;
    --border: #e0e0e5;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
    --text: #1c1c1e; --text-muted: #6b6b70;
    --accent: #d4622a; --accent-dim: rgba(212, 98, 42, 0.1);
    --radius: 12px; --header-h: 52px; --nav-h: 56px;
    --green: #34c759; --orange: #ff9500;
}

[data-theme="dark"] {
    --bg: #111113; --surface: #1c1c1e; --surface2: #252528;
    --border: #38383a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    --text: #f2f2f7; --text-muted: #98989e;
    --accent: #e0723a; --accent-dim: rgba(224, 114, 58, 0.15);
}

html, body {
    height: 100%; background: var(--bg); color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px; -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

/* ── Header ───────────────────────────────────────── */
.sm-header {
    position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
    background: var(--bg); border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex; align-items: center; padding: 0 12px; z-index: 100; gap: 8px;
}
.sm-header-back {
    background: none; border: none; font-size: 22px; color: var(--accent);
    padding: 4px 8px 4px 0; line-height: 1; cursor: pointer;
    -webkit-tap-highlight-color: transparent; text-decoration: none;
    display: flex; align-items: center;
}
.app-logo {
    width: 26px;
    height: 29px;
    flex-shrink: 0;
}
.sm-header-back ~ .app-logo { display: none; }
.sm-header-back ~ .app-name { display: none; }

.app-name {
    font-family: 'Permanent Marker', cursive;
    font-size: 17px;
    color: var(--accent);
    white-space: nowrap;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    line-height: 1;
}

.sm-header-title { font-size: 17px; font-weight: 700; flex: 1; text-align: center; }
[data-theme="dark"] .sm-header { background: var(--surface); }

/* ── Main ─────────────────────────────────────────── */
.setup-main {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: calc(var(--header-h) + 16px) 16px calc(var(--nav-h) + 24px);
}

/* ── Status indicator ─────────────────────────────── */
.status-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); margin-bottom: 24px;
}
.status-dot {
    width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
    background: var(--orange); transition: background 0.3s;
}
.status-dot.detected { background: var(--green); }
.status-dot.outdated { background: var(--orange); animation: pulse-orange 1.5s ease-in-out infinite alternate; }
@keyframes pulse-orange { from { opacity: 0.7; } to { opacity: 1; } }
.status-label { font-size: 15px; font-weight: 600; flex: 1; }
.status-sub { font-size: 12px; color: var(--text-muted); }

/* ── Steps ────────────────────────────────────────── */
.setup-steps { display: flex; flex-direction: column; gap: 16px; }

.step-card {
    display: flex; gap: 14px; padding: 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.step-num {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 14px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.step-body { flex: 1; min-width: 0; }
.step-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.step-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ── Code block (chrome://extensions) ─────────────── */
.code-block {
    display: flex; align-items: center; gap: 8px;
    margin-top: 8px; padding: 8px 12px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; font-family: 'SF Mono', Menlo, monospace; font-size: 13px;
}
.code-block code { flex: 1; user-select: all; word-break: break-all; }
.code-copy-btn {
    background: none; border: none; color: var(--accent);
    font-size: 12px; font-weight: 600; cursor: pointer;
    padding: 4px 8px; border-radius: 6px; white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.code-copy-btn:hover { background: var(--accent-dim); }

/* ── Download button ──────────────────────────────── */
.download-btn {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 10px; padding: 10px 20px;
    background: var(--accent); color: #fff; border: none;
    border-radius: 10px; font-size: 14px; font-weight: 700;
    cursor: pointer; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s, transform 0.1s;
}
.download-btn:hover { opacity: 0.9; }
.download-btn:active { transform: scale(0.97); }
.download-btn svg { width: 16px; height: 16px; }

/* ── Check status button ──────────────────────────── */
.check-btn {
    display: block; width: 100%; margin-top: 24px; padding: 14px;
    background: none; border: 1px solid var(--accent);
    border-radius: var(--radius); color: var(--accent);
    font-size: 15px; font-weight: 600; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
}
.check-btn:hover { background: var(--accent-dim); }
.check-btn:active { transform: scale(0.98); }

.hidden { display: none !important; }

/* ── Bottom Nav ───────────────────────────────────── */
.sm-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h);
    background: var(--bg); border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-around;
    z-index: 100; padding-bottom: env(safe-area-inset-bottom, 0);
}
[data-theme="dark"] .sm-nav { background: var(--surface); border-top-color: var(--border); }
.sm-nav-btn {
    flex: 1; background: none; border: none; display: flex; flex-direction: column;
    align-items: center; gap: 2px; padding: 8px 0; color: var(--text-muted);
    font: inherit; -webkit-tap-highlight-color: transparent; cursor: pointer; text-decoration: none;
}
.sm-nav-btn.active { color: var(--accent); }
svg.sm-nav-icon { width: 24px; height: 24px; stroke-width: 1.5; }
.sm-nav-btn.active svg.sm-nav-icon { stroke-width: 2.5; }
.sm-nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; }

@media (min-width: 600px) {
    .setup-main { max-width: 480px; margin: 0 auto; }
}
