/* AdAutomate Compliance Checker — Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #f8fafc; --card-bg: #ffffff; --text: #1e293b; --text-secondary: #64748b;
    --border: #e2e8f0; --primary: #6366f1; --primary-hover: #4f46e5;
    --clean: #10B981; --review: #F59E0B; --at-risk: #F97316; --high-risk: #EF4444;
    --red-bg: #FEF2F2; --red-border: #FECACA; --yellow-bg: #FFFBEB; --yellow-border: #FDE68A;
    --green-bg: #ECFDF5; --green-border: #A7F3D0;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a; --card-bg: #1e293b; --text: #e2e8f0; --text-secondary: #94a3b8;
        --border: #334155; --primary: #818cf8; --primary-hover: #6366f1;
    }
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg); color: var(--text); min-height: 100vh;
    line-height: 1.6;
}
header {
    background: var(--card-bg); border-bottom: 1px solid var(--border);
    padding: 16px 32px; display: flex; justify-content: space-between; align-items: center;
}
.logo { font-size: 1.4em; font-weight: 700; }
.version { font-size: 0.85em; color: var(--text-secondary); background: var(--bg); padding: 4px 10px; border-radius: 12px; }

main { max-width: 960px; margin: 32px auto; padding: 0 20px; }

.form-container {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
    padding: 32px; margin-bottom: 32px;
}
.form-container h2 { font-size: 1.5em; margin-bottom: 4px; }
.subtitle { color: var(--text-secondary); margin-bottom: 24px; }

.form-group { margin-bottom: 16px; flex: 1; }
.form-group label {
    display: block; font-weight: 600; margin-bottom: 6px;
    font-size: 0.9em; color: var(--text-secondary);
}
.form-group textarea, .form-group input, .form-group select {
    width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 16px; font-family: inherit; background: var(--bg); color: var(--text);
    transition: border-color 0.2s;
}
.form-group textarea:focus, .form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.char-count { text-align: right; font-size: 0.8em; color: var(--text-secondary); margin-top: 4px; }
.form-row { display: flex; gap: 16px; }
.form-row-triple .form-group { flex: 1; }

.btn-primary {
    width: 100%; padding: 14px; background: var(--primary); color: white;
    border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer;
    transition: background 0.2s; display: flex; justify-content: center; align-items: center; gap: 8px;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }

.spinner {
    width: 20px; height: 20px; border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.results-container {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
    padding: 32px;
}
.score-section {
    display: flex; align-items: center; justify-content: center; gap: 32px;
    margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border);
}
.score-gauge { text-align: center; }
.score-number { font-size: 72px; font-weight: 800; line-height: 1; }
.score-label { color: var(--text-secondary); font-size: 0.9em; margin-top: 4px; }
.status-badge {
    padding: 8px 20px; border-radius: 20px; font-weight: 600; font-size: 1em;
}

.section { margin-bottom: 24px; }
.section h3 { margin-bottom: 12px; font-size: 1.1em; }

.violation-item {
    padding: 12px; border-radius: 8px; margin-bottom: 8px;
    border-left: 4px solid;
}
.violation-item.red { background: var(--red-bg); border-left-color: var(--high-risk); }
.violation-item.warning { background: var(--yellow-bg); border-left-color: var(--review); }
.violation-phrase { font-weight: 700; }
.violation-reason { color: var(--text-secondary); font-size: 0.9em; margin: 4px 0; }
.violation-suggestion { font-style: italic; color: var(--primary); font-size: 0.9em; }

.platform-warning-item {
    padding: 8px 12px; border-radius: 6px; margin-bottom: 6px;
    background: var(--yellow-bg); color: var(--text); font-size: 0.9em;
}

.tone-box {
    padding: 16px; border-radius: 8px; background: var(--bg);
    display: flex; gap: 20px; flex-wrap: wrap;
}
.tone-stat { text-align: center; }
.tone-stat .label { font-size: 0.8em; color: var(--text-secondary); }
.tone-stat .value { font-size: 1.2em; font-weight: 700; }
.tone-match { color: var(--clean); }
.tone-mismatch { color: var(--high-risk); }

.action-plan-list li {
    padding: 10px; margin-bottom: 8px; background: var(--bg); border-radius: 6px;
    font-size: 0.95em;
}
.action-plan-list li .priority { font-size: 0.75em; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.priority.critical { background: #FEE2E2; color: #DC2626; }
.priority.high { background: #FEF3C7; color: #D97706; }
.priority.medium { background: #DBEAFE; color: #2563EB; }

.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare-col h4 { margin-bottom: 8px; font-size: 0.9em; color: var(--text-secondary); }
.preview-box {
    padding: 16px; border-radius: 8px; font-size: 0.95em; min-height: 80px;
    white-space: pre-wrap; word-break: break-word;
}
.original-text { background: var(--red-bg); border: 1px solid var(--red-border); }
.fixed-text { background: var(--green-bg); border: 1px solid var(--green-border); }

.action-buttons { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.btn-secondary {
    padding: 10px 20px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--card-bg); color: var(--text); font-size: 0.95em; cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--primary); }

.error-msg {
    background: var(--red-bg); border: 1px solid var(--red-border); color: var(--high-risk);
    padding: 16px; border-radius: 8px; margin-top: 16px;
}

footer {
    text-align: center; padding: 24px; color: var(--text-secondary);
    font-size: 0.85em; border-top: 1px solid var(--border); margin-top: 48px;
}

@media (max-width: 640px) {
    .form-row, .form-row-triple { flex-direction: column; }
    .score-section { flex-direction: column; gap: 12px; }
    .compare-grid { grid-template-columns: 1fr; }
    .action-buttons { flex-direction: column; }
    .btn-secondary { text-align: center; }
}
