/* RepairScan — Public Frontend Styles */
/* Colors are injected via CSS custom properties from settings */

.rscn-wrap {
    --primary: var(--rscn-primary, #0a5c9e);
    --primary-dark: color-mix(in srgb, var(--primary), black 15%);
    --primary-subtle: color-mix(in srgb, var(--primary), white 88%);
    --primary-ghost: color-mix(in srgb, var(--primary), white 94%);
    --accent: var(--rscn-accent, #ff6b00);
    --accent-dark: color-mix(in srgb, var(--accent), black 10%);
    --green: #16a34a;
    --green-bg: #f0fdf4;
    --green-border: #bbf7d0;
    --yellow: #ca8a04;
    --yellow-bg: #fefce8;
    --yellow-border: #fef08a;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --red-border: #fecaca;
    --bg: #f7f8fa;
    --bg-white: #ffffff;
    --border: #e2e5ea;
    --border-light: #eef0f3;
    --text: #1a2332;
    --text-sec: #4a5568;
    --text-muted: #8896a7;
    --shadow-md: 0 4px 16px rgba(10,92,158,0.08);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
    --sans: 'IBM Plex Sans', -apple-system, sans-serif;

    font-family: var(--sans);
    color: var(--text);
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* ── Search Section ── */
.rscn-search-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 36px;
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
}
.rscn-search-header {
    text-align: center;
    margin-bottom: 28px;
}
.rscn-search-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
    padding: 0;
    border: none;
}
.rscn-search-header p {
    font-size: 14px;
    color: var(--text-sec);
    line-height: 1.5;
    margin: 0;
}

.rscn-search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}
.rscn-search-input {
    width: 100% !important;
    padding: 16px 56px 16px 20px !important;
    font-family: var(--mono) !important;
    font-size: 15px !important;
    font-weight: 500;
    border: 2px solid var(--border) !important;
    border-radius: var(--radius) !important;
    background: var(--bg) !important;
    color: var(--text);
    outline: none;
    transition: all 0.25s ease;
    letter-spacing: 0.3px;
    box-shadow: none !important;
    height: auto !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}
.rscn-search-input::placeholder { color: var(--text-muted); font-weight: 400; }
.rscn-search-input:focus {
    border-color: var(--primary) !important;
    background: var(--bg-white) !important;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary), transparent 88%) !important;
}
.rscn-search-btn {
    position: absolute;
    right: 6px;
    top: 6px;
    bottom: 6px;
    width: 44px;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    background: var(--accent) !important;
    color: #fff !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0 !important;
}
.rscn-search-btn:hover {
    background: var(--accent-dark) !important;
    box-shadow: 0 4px 20px color-mix(in srgb, var(--accent), transparent 70%);
}

/* Chips */
.rscn-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}
.rscn-hint-chip {
    padding: 6px 14px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-ghost);
    border: 1px solid var(--primary-subtle);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.rscn-hint-chip:hover {
    background: var(--primary-subtle);
    border-color: var(--primary);
    color: var(--primary-dark);
}

/* Scan bar */
.rscn-scan-bar {
    display: none;
    margin: 20px auto 0;
    max-width: 600px;
}
.rscn-scan-bar.active { display: block; }
.rscn-scan-track {
    height: 3px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}
.rscn-scan-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width 0.5s ease;
}
.rscn-scan-text {
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 10px;
    font-family: var(--mono);
    letter-spacing: 0.5px;
}

/* ── Result ── */
.rscn-result {
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.5s ease;
    pointer-events: none;
}
.rscn-result.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Status bar */
.rscn-status-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 28px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    flex-wrap: wrap;
}
.rscn-status-bar.ok { background: var(--green-bg); border-color: var(--green-border); }
.rscn-status-bar.warn { background: var(--yellow-bg); border-color: var(--yellow-border); }
.rscn-status-bar.eol { background: var(--red-bg); border-color: var(--red-border); }
.rscn-status-bar.unknown { background: var(--bg); }

.rscn-status-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    color: #fff;
}
.ok .rscn-status-icon { background: var(--green); }
.warn .rscn-status-icon { background: var(--yellow); }
.eol .rscn-status-icon { background: var(--red); }
.unknown .rscn-status-icon { background: var(--text-muted); }

.rscn-status-info { flex: 1; }
.rscn-status-label { font-size: 17px; font-weight: 700; margin-bottom: 2px; }
.ok .rscn-status-label { color: var(--green); }
.warn .rscn-status-label { color: var(--yellow); }
.eol .rscn-status-label { color: var(--red); }
.unknown .rscn-status-label { color: var(--text-muted); }
.rscn-status-desc { font-size: 13px; color: var(--text-sec); }
.rscn-status-pn {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: rgba(255,255,255,0.7);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* Result body */
.rscn-result-body {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
}

/* History */
.rscn-history {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-radius: var(--radius);
    background: var(--primary-ghost);
    border: 1px solid var(--primary-subtle);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.rscn-history-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--mono);
    line-height: 1;
}
.rscn-history-detail h4 { font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 2px 0; }
.rscn-history-detail p { font-size: 13px; color: var(--text-sec); margin: 0; }
.rscn-history-rate { margin-left: auto; text-align: center; }
.rscn-history-rate .rate-val { font-size: 22px; font-weight: 700; color: var(--green); font-family: var(--mono); }
.rscn-history-rate .rate-lbl { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Price grid */
.rscn-price-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.rscn-price-card {
    padding: 18px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    text-align: center;
}
.rscn-price-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}
.rscn-price-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--mono);
}
.rscn-price-card-value.accent { color: var(--accent); }

/* Info grid */
.rscn-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.rscn-info-item {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border-light);
}
.rscn-info-item-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.rscn-info-item-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* Specs accordion */
.rscn-specs-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
    margin: 20px 0 0;
}
.rscn-specs-toggle:hover { background: var(--primary-ghost); border-color: var(--primary-subtle); }
.rscn-specs-content {
    display: none;
    padding: 16px;
    margin-top: 8px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border-light);
}
.rscn-specs-content.visible { display: block; }
.rscn-spec-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.rscn-spec-row:last-child { border-bottom: none; }
.rscn-spec-key { color: var(--text-muted); font-weight: 500; }
.rscn-spec-val { color: var(--text); font-weight: 600; font-family: var(--mono); font-size: 12px; }

/* Alert */
.rscn-alert {
    display: flex;
    gap: 14px;
    padding: 18px 22px;
    border-radius: var(--radius);
    margin: 22px 0;
    align-items: flex-start;
}
.rscn-alert.danger { background: var(--red-bg); border: 1px solid var(--red-border); }
.rscn-alert.warning { background: var(--yellow-bg); border: 1px solid var(--yellow-border); }
.rscn-alert-icon { font-size: 20px; flex-shrink: 0; }
.rscn-alert-text h4 { font-size: 14px; font-weight: 700; margin: 0 0 4px 0; }
.rscn-alert.danger .rscn-alert-text h4 { color: var(--red); }
.rscn-alert.warning .rscn-alert-text h4 { color: var(--yellow); }
.rscn-alert-text p { font-size: 13px; color: var(--text-sec); line-height: 1.5; margin: 0; }

/* CTA */
.rscn-cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}
.rscn-btn-primary {
    padding: 14px 28px;
    background: var(--accent);
    color: #fff !important;
    border: none;
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
}
.rscn-btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 20px color-mix(in srgb, var(--accent), transparent 70%);
    transform: translateY(-1px);
}
.rscn-btn-secondary {
    padding: 14px 28px;
    background: var(--bg-white);
    color: var(--primary) !important;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
}
.rscn-btn-secondary:hover { background: var(--primary-ghost); transform: translateY(-1px); }

/* Responsive */
@media (max-width: 640px) {
    .rscn-search-section { padding: 24px 18px; }
    .rscn-search-header h2 { font-size: 20px; }
    .rscn-price-grid { grid-template-columns: repeat(2, 1fr); }
    .rscn-info-grid { grid-template-columns: 1fr; }
    .rscn-status-bar { padding: 16px; }
    .rscn-status-pn { order: 3; width: 100%; text-align: center; margin-top: 4px; }
    .rscn-result-body { padding: 20px 16px; }
    .rscn-cta { flex-direction: column; }
    .rscn-btn-primary, .rscn-btn-secondary { justify-content: center; width: 100%; }
    .rscn-history { flex-direction: column; text-align: center; }
    .rscn-history-rate { margin-left: 0; }
}
