/* Campaign Reviewer UI Styles */

:root {
    --color-bg: #f5f6f8;
    --color-surface: #ffffff;
    --color-surface-subtle: #fafbfc;
    --color-border: #dfe5ee;
    --color-border-strong: #cbd5e1;
    --color-text: #17202e;
    --color-text-muted: #62708a;
    --color-text-soft: #7a879b;
    --color-primary: #1f6feb;
    --color-primary-hover: #1b5fc9;
    --color-primary-soft: #edf5ff;
    --color-error: #d92d20;
    --color-error-bg: #fef2f2;
    --color-error-border: #fecaca;
    --color-warning: #b86b00;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;
    --color-info: #1f6feb;
    --color-info-bg: #eff6ff;
    --color-info-border: #bfdbfe;
    --color-success: #128a49;
    --color-success-bg: #f0fdf4;
    --color-success-border: #bbf7d0;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 24px rgba(15, 23, 42, 0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 0.92rem;
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: none;
}

.card h2 {
    font-size: 1rem;
    line-height: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Form */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 650;
    font-size: 0.84rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.file-drop {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 1.35rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    background: var(--color-surface-subtle);
}

.file-drop:hover,
.file-drop.dragover {
    border-color: var(--color-primary);
    background: var(--color-info-bg);
}

.file-drop input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-text {
    color: var(--color-text-muted);
    font-size: 0.88rem;
}

.file-name {
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.56rem 0.9rem;
    font-size: 0.84rem;
    font-weight: 650;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, opacity 0.2s;
    text-decoration: none;
    line-height: 1.1;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--color-primary);
    color: white;
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--color-primary);
    color: white;
}

.btn-secondary:hover {
    background: var(--color-primary-hover);
}

.btn-ghost {
    background: var(--color-surface);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-ghost:hover {
    background: var(--color-surface-subtle);
    border-color: var(--color-border-strong);
    color: var(--color-text);
}

.btn-sm {
    padding: 0.42rem 0.64rem;
    font-size: 0.78rem;
}

.icon {
    width: 1rem;
    height: 1rem;
    color: currentColor;
    flex: 0 0 auto;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn .icon {
    width: 0.9rem;
    height: 0.9rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading p {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.loading-detail {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* Results Summary */
.results-summary {
    border-left: 4px solid var(--color-primary);
}

.results-summary.status-fail {
    border-left-color: var(--color-error);
}

.results-summary.status-warn {
    border-left-color: var(--color-warning);
}

.results-summary.status-pass {
    border-left-color: var(--color-success);
}

.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.summary-header h2 {
    margin-bottom: 0;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge.pass {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

.status-badge.warn {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
}

.status-badge.fail {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid var(--color-error-border);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.metric {
    text-align: center;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.metric-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.metric-label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.125rem;
}

.metric-error { color: var(--color-error); }
.metric-warning { color: var(--color-warning); }
.metric-info { color: var(--color-info); }

.summary-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Variant Cards */
.variant-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.variant-header {
    padding: 1rem 1.5rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.variant-header:hover {
    background: #edf2f7;
}

.variant-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.variant-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.variant-toggle {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    transition: transform 0.2s;
}

.variant-card.expanded .variant-toggle {
    transform: rotate(180deg);
}

.variant-body {
    padding: 1.5rem;
    display: none;
}

.variant-card.expanded .variant-body {
    display: block;
}

/* Findings */
.category-group {
    margin-bottom: 1.25rem;
}

.category-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.finding {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.finding.severity-error {
    background: var(--color-error-bg);
    border: 1px solid var(--color-error-border);
}

.finding.severity-warning {
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
}

.finding.severity-info {
    background: var(--color-info-bg);
    border: 1px solid var(--color-info-border);
}

.finding-description {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.finding-detail {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.finding-detail strong {
    color: var(--color-text);
}

.finding-recommendation {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--color-text);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* No findings state */
.no-findings {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-success);
    font-weight: 500;
}

/* Error state */
.error-message {
    text-align: center;
    padding: 1rem 0;
}

.error-message h3 {
    color: var(--color-error);
    margin-bottom: 0.5rem;
}

.error-message p {
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .summary-actions {
        flex-direction: column;
    }

    .summary-actions .btn {
        width: 100%;
    }
}
