/* ================================================================
   BRIGHTSIDE AUDIT MACHINE — Frontend Styles
   Brand: Sky Blue #5ED4FA | Coral #F56B80 | Gold #FDCC5F
   Designed to blend seamlessly into any WordPress theme.
   ================================================================ */

/* Reset & Container */
.bam-container {
    --bam-blue: #5ED4FA;
    --bam-blue-dark: #3BB8E0;
    --bam-coral: #F56B80;
    --bam-coral-dark: #E04E64;
    --bam-gold: #FDCC5F;
    --bam-olive: #C4BE5E;
    --bam-mauve: #BB5C7C;
    --bam-text: #1a1a2e;
    --bam-text-muted: #6b7280;
    --bam-bg: #ffffff;
    --bam-bg-alt: #f8f9fb;
    --bam-border: #e5e7eb;
    --bam-radius: 12px;
    --bam-radius-sm: 8px;
    --bam-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --bam-shadow-lg: 0 10px 25px rgba(0,0,0,0.08);

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 720px;
    margin: 2rem auto;
    padding: 0;
    color: var(--bam-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.bam-container *, .bam-container *::before, .bam-container *::after {
    box-sizing: border-box;
}

/* Steps */
.bam-step { display: none; }
.bam-step.bam-active { display: block; animation: bamFadeIn 0.4s ease; }
@keyframes bamFadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ─── FORM ─── */
.bam-form-header {
    text-align: center;
    margin-bottom: 2rem;
}
.bam-logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--bam-bg-alt);
    border-radius: 50%;
    margin-bottom: 1rem;
}
.bam-heading {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: var(--bam-text);
    letter-spacing: -0.02em;
}
.bam-subheading {
    font-size: 1rem;
    color: var(--bam-text-muted);
    margin: 0;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.bam-form { max-width: 480px; margin: 0 auto; }

.bam-field {
    margin-bottom: 1.25rem;
}
.bam-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--bam-text);
}
.bam-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.bam-input-icon {
    position: absolute;
    left: 14px;
    color: var(--bam-text-muted);
    display: flex;
    pointer-events: none;
}
.bam-input-wrap input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.75rem;
    border: 1.5px solid var(--bam-border);
    border-radius: var(--bam-radius-sm);
    font-size: 1rem;
    background: var(--bam-bg);
    color: var(--bam-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.bam-input-wrap input:focus {
    border-color: var(--bam-blue);
    box-shadow: 0 0 0 3px rgba(94, 212, 250, 0.15);
}
.bam-input-wrap input::placeholder { color: #9ca3af; }

/* Buttons */
.bam-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--bam-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.2;
}
.bam-btn-primary {
    width: 100%;
    background: var(--bam-blue);
    color: #fff;
}
.bam-btn-primary:hover { background: var(--bam-blue-dark); transform: translateY(-1px); box-shadow: var(--bam-shadow-lg); }
.bam-btn-primary:active { transform: translateY(0); }

.bam-btn-cta {
    width: 100%;
    background: var(--bam-coral);
    color: #fff;
}
.bam-btn-cta:hover { background: var(--bam-coral-dark); transform: translateY(-1px); box-shadow: var(--bam-shadow-lg); }

.bam-btn-ghost {
    background: transparent;
    color: var(--bam-text-muted);
    border: 1.5px solid var(--bam-border);
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
}
.bam-btn-ghost:hover { border-color: var(--bam-blue); color: var(--bam-blue); }

.bam-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.bam-form-note {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--bam-text-muted);
    margin-top: 1rem;
}

.bam-error {
    background: #FFF5F5;
    border: 1px solid #FED7D7;
    color: #C53030;
    padding: 0.75rem 1rem;
    border-radius: var(--bam-radius-sm);
    font-size: 0.875rem;
    margin-top: 1rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* Spinner */
.bam-spinner { animation: bamSpin 0.8s linear infinite; }
@keyframes bamSpin { to { transform: rotate(360deg); } }

/* ─── LOADING ─── */
.bam-loading-content {
    text-align: center;
    padding: 3rem 1rem;
}
.bam-loading-animation {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
}
.bam-scan-ring {
    position: absolute;
    inset: 0;
    border: 3px solid var(--bam-border);
    border-top-color: var(--bam-blue);
    border-radius: 50%;
    animation: bamSpin 1.2s linear infinite;
}
.bam-scan-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bam-loading-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}
.bam-loading-status {
    font-size: 0.875rem;
    color: var(--bam-text-muted);
    margin: 0 0 1.5rem;
}
.bam-progress-bar {
    width: 100%;
    max-width: 320px;
    height: 6px;
    background: var(--bam-bg-alt);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto;
}
.bam-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--bam-blue), var(--bam-coral));
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ─── RESULTS ─── */
.bam-results-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--bam-bg-alt);
    border-radius: var(--bam-radius);
    margin-bottom: 2rem;
}
.bam-score-ring-wrap {
    position: relative;
    flex-shrink: 0;
}
.bam-score-ring {
    width: 120px;
    height: 120px;
}
#bam-score-circle {
    transition: stroke-dashoffset 1.5s ease;
}
.bam-score-value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
#bam-score-number {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    color: var(--bam-text);
}
.bam-score-max {
    font-size: 0.8125rem;
    color: var(--bam-text-muted);
    font-weight: 500;
}
.bam-results-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}
.bam-audited-url {
    font-size: 0.875rem;
    color: var(--bam-text-muted);
    margin: 0 0 0.5rem;
    word-break: break-all;
}
.bam-results-summary {
    font-size: 0.9375rem;
    margin: 0;
    color: var(--bam-text);
}

/* Category Bars */
.bam-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}
.bam-category-card {
    background: var(--bam-bg);
    border: 1.5px solid var(--bam-border);
    border-radius: var(--bam-radius-sm);
    padding: 1.25rem;
    transition: border-color 0.2s;
}
.bam-category-card:hover { border-color: var(--bam-blue); }
.bam-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.bam-cat-label {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bam-text-muted);
}
.bam-cat-grade {
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}
.bam-grade-A { background: #D1FAE5; color: #065F46; }
.bam-grade-B { background: #DBEAFE; color: #1E40AF; }
.bam-grade-C { background: #FEF3C7; color: #92400E; }
.bam-grade-D { background: #FED7AA; color: #9A3412; }
.bam-grade-F { background: #FEE2E2; color: #991B1B; }

.bam-cat-score-num {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
    color: var(--bam-text);
}
.bam-cat-bar {
    width: 100%;
    height: 6px;
    background: var(--bam-bg-alt);
    border-radius: 3px;
    overflow: hidden;
}
.bam-cat-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease 0.3s;
    width: 0%;
}

/* Issues List */
.bam-issues-section { margin-bottom: 2rem; }
.bam-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--bam-text);
}
.bam-issue-card {
    background: var(--bam-bg);
    border: 1.5px solid var(--bam-border);
    border-radius: var(--bam-radius-sm);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--bam-border);
}
.bam-issue-card.bam-severity-critical { border-left-color: var(--bam-coral); }
.bam-issue-card.bam-severity-warning { border-left-color: var(--bam-gold); }
.bam-issue-card.bam-severity-info { border-left-color: var(--bam-blue); }

.bam-issue-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.bam-severity-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
}
.bam-severity-critical .bam-severity-badge { background: #FEE2E2; color: #991B1B; }
.bam-severity-warning .bam-severity-badge { background: #FEF3C7; color: #92400E; }
.bam-severity-info .bam-severity-badge { background: #DBEAFE; color: #1E40AF; }
.bam-issue-label {
    font-weight: 600;
    font-size: 0.9375rem;
}
.bam-issue-message {
    font-size: 0.875rem;
    color: var(--bam-text-muted);
    margin: 0 0 0.5rem;
    line-height: 1.5;
}
.bam-issue-fix {
    font-size: 0.8125rem;
    background: var(--bam-bg-alt);
    border-radius: 6px;
    padding: 0.75rem;
    color: var(--bam-text);
    line-height: 1.5;
}
.bam-issue-fix strong {
    color: var(--bam-blue-dark);
}

/* Gate Section */
.bam-gate-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #fdf4ff 100%);
    border: 2px solid var(--bam-border);
    border-radius: var(--bam-radius);
    overflow: hidden;
    margin-bottom: 2rem;
}
.bam-gate-content {
    padding: 2rem;
    text-align: center;
}
.bam-gate-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bam-bg);
    padding: 0.375rem 1rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--bam-coral);
    border: 1px solid var(--bam-border);
    margin-bottom: 1rem;
}
.bam-gate-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}
.bam-gate-desc {
    font-size: 0.9375rem;
    color: var(--bam-text-muted);
    margin: 0 0 1.5rem;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
}
.bam-lead-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.bam-lead-fields input {
    width: 100%;
    padding: 0.75rem;
    border: 1.5px solid var(--bam-border);
    border-radius: var(--bam-radius-sm);
    font-size: 0.9375rem;
    background: var(--bam-bg);
    color: var(--bam-text);
    outline: none;
    transition: border-color 0.2s;
}
.bam-lead-fields input:focus { border-color: var(--bam-coral); }
.bam-lead-fields input::placeholder { color: #9ca3af; }

/* Thank You */
.bam-thank-you {
    text-align: center;
    padding: 2rem;
    background: var(--bam-bg-alt);
    border-radius: var(--bam-radius);
    margin-bottom: 2rem;
}
.bam-ty-icon { margin-bottom: 1rem; }
.bam-thank-you h3 {
    font-size: 1.25rem;
    margin: 0 0 0.5rem;
}
.bam-thank-you p {
    color: var(--bam-text-muted);
    margin: 0 0 1.5rem;
}

/* Footer */
.bam-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--bam-border);
}
.bam-powered {
    font-size: 0.75rem;
    color: var(--bam-text-muted);
    margin-top: 0.75rem;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
    .bam-container { margin: 1rem; }
    .bam-results-header { flex-direction: column; text-align: center; gap: 1.25rem; padding: 1.5rem; }
    .bam-categories { grid-template-columns: 1fr; }
    .bam-lead-fields { grid-template-columns: 1fr; }
    .bam-heading { font-size: 1.5rem; }
    .bam-results-title { font-size: 1.25rem; }
    .bam-gate-content { padding: 1.5rem; }
}

/* ─── DARK MODE SUPPORT ─── */
@media (prefers-color-scheme: dark) {
    .bam-container {
        --bam-text: #e5e7eb;
        --bam-text-muted: #9ca3af;
        --bam-bg: #1f2937;
        --bam-bg-alt: #111827;
        --bam-border: #374151;
    }
    .bam-input-wrap input,
    .bam-lead-fields input {
        background: #1f2937;
        color: #e5e7eb;
    }
    .bam-gate-section { background: linear-gradient(135deg, #111827 0%, #1f2937 100%); }
    .bam-gate-badge { background: #1f2937; }
}
