/* ============================================
   Fikua Lab — Certificate Selection
   Light/Dark theme with Fikua Lab design system
   ============================================ */

:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --text: #334155;
    --text-muted: #64748b;
    --heading: #0f172a;
    --accent: #2A9D8F;
    --accent-hover: #238578;
    --accent-subtle: rgba(42, 157, 143, 0.08);
    --success: #10b981;
    --danger: #ef4444;
    --nav-bg: rgba(255, 255, 255, 0.85);
    --btn-accent-text: #fff;
    --radius: 8px;
    --radius-lg: 12px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #22263a;
    --border: #2a2e3f;
    --text: #e1e4ed;
    --text-muted: #8b90a0;
    --heading: #e2e8f0;
    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --accent-subtle: rgba(45, 212, 191, 0.1);
    --success: #34d399;
    --danger: #f87171;
    --nav-bg: rgba(15, 17, 23, 0.9);
    --btn-accent-text: #0f1117;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* --- Theme Toggle --- */
.theme-toggle {
    background: none; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.35rem; cursor: pointer; color: var(--text-muted);
    display: inline-flex; align-items: center; justify-content: center;
    transition: color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { color: var(--heading); border-color: var(--text-muted); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.nav-links { display: flex; align-items: center; gap: 0.75rem; }

/* --- Nav --- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    transition: background 0.3s, border-color 0.3s;
}

.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--heading);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
}

.nav-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
}

.nav-label {
    font-size: 0.8rem;
    font-family: var(--mono);
    color: var(--text-muted);
    background: var(--surface);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* --- Main --- */
main {
    display: flex;
    justify-content: center;
    padding: 4rem 1.5rem;
}

.cert-container {
    max-width: 480px;
    width: 100%;
}

/* --- Phases --- */
.phase { text-align: center; }

.cert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--accent-subtle);
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.cert-icon--error {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
}

.cert-icon--success {
    background: rgba(52, 211, 153, 0.1);
    color: var(--success);
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 0.5rem;
}

.cert-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

.status-text {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-top: 1rem;
}

/* --- Spinner --- */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Certificate List --- */
.cert-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.cert-option {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.cert-option:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
}

.cert-option.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.cert-option input[type="radio"] {
    margin-top: 0.25rem;
    accent-color: var(--accent);
}

.cert-details { flex: 1; }

.cert-details .cert-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--heading);
    display: block;
    margin-bottom: 0.25rem;
}

.cert-details .cert-meta {
    font-size: 0.75rem;
    font-family: var(--mono);
    color: var(--text-muted);
    display: block;
    line-height: 1.5;
}

/* --- Buttons --- */
.btn {
    font-family: var(--font);
    font-size: 0.875rem;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
}
.btn:hover { background: var(--surface-hover); }

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--btn-accent-text);
    font-weight: 600;
}
.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.btn-accent:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cert-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

/* --- Progress Bar --- */
.progress-bar {
    width: 200px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 1.5rem auto 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 2px;
    animation: progress 2s ease-in-out forwards;
}

@keyframes progress {
    from { width: 0; }
    to { width: 100%; }
}

.hidden { display: none; }

/* --- Responsive --- */
@media (max-width: 768px) {
    main { padding: 2rem 1rem; }
}
