/**
 * Tonewriter Frontend Styles
 * Modern, clean design with primary color #0c19bc
 */

/* CSS Variables */
:root {
    --tw-primary: #0c19bc;
    --tw-primary-hover: #0a1496;
    --tw-primary-light: #e8eafc;
    --tw-primary-gradient: linear-gradient(135deg, #0c19bc 0%, #1e3a8a 100%);
    --tw-secondary: #64748b;
    --tw-success: #10B981;
    --tw-success-bg: #ecfdf5;
    --tw-warning: #f59e0b;
    --tw-warning-bg: #fffbeb;
    --tw-error: #ef4444;
    --tw-error-bg: #fef2f2;
    --tw-bg: #f8fafc;
    --tw-bg-white: #ffffff;
    --tw-border: #e2e8f0;
    --tw-text: #1e293b;
    --tw-text-light: #64748b;
    --tw-radius: 16px;
    --tw-radius-sm: 10px;
    --tw-shadow: 0 1px 3px rgba(12, 25, 188, 0.08), 0 1px 2px rgba(0,0,0,0.04);
    --tw-shadow-lg: 0 10px 25px -5px rgba(12, 25, 188, 0.15), 0 8px 10px -6px rgba(0,0,0,0.05);
    --tw-shadow-hover: 0 4px 12px rgba(12, 25, 188, 0.2);
    --tw-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
.tonewriter-app {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--tw-text);
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
    line-height: 1.6;
}

.tonewriter-app * {
    box-sizing: border-box;
}

/* Old header - hidden since integrated into section */
.tonewriter-header {
    display: none;
}

/* Hero Section with integrated header */
.tonewriter-hero-section {
    background: var(--tw-bg-white);
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius);
    overflow: hidden;
}

.tonewriter-section-header {
    background: var(--tw-primary-gradient);
    color: white;
    padding: 32px 24px;
    margin: -24px -24px 24px -24px;
    text-align: center;
}

.tonewriter-section-header .tonewriter-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.tonewriter-section-header .tonewriter-subtitle {
    color: rgba(255,255,255,0.85);
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
}

.tonewriter-section-header .admin-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
}

.tonewriter-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--tw-primary);
    margin: 0 0 8px 0;
}

.tonewriter-subtitle {
    color: var(--tw-text-light);
    margin: 0;
    font-size: 1rem;
}

.admin-badge {
    display: inline-block;
    background: var(--tw-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sections */
.tonewriter-section {
    background: var(--tw-bg-white);
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--tw-shadow);
    transition: var(--tw-transition);
}

.tonewriter-section:hover {
    box-shadow: var(--tw-shadow-hover);
}

.tonewriter-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--tw-text);
}

.section-description {
    color: var(--tw-text-light);
    font-size: 0.875rem;
    margin: -8px 0 16px 0;
}

/* Dropdowns */
.tonewriter-dropdowns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .tonewriter-dropdowns {
        grid-template-columns: 1fr;
    }
}

.tonewriter-dropdown-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tonewriter-dropdown-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tw-text);
}

/* Wrapper for select + add button */
.tonewriter-dropdown-group .select-wrapper {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.tonewriter-select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius-sm);
    font-size: 0.95rem;
    color: var(--tw-text);
    background: var(--tw-bg-white);
    cursor: pointer;
    transition: var(--tw-transition);
}

.tonewriter-select:hover {
    border-color: var(--tw-primary);
}

.tonewriter-select:focus {
    outline: none;
    border-color: var(--tw-primary);
    box-shadow: 0 0 0 3px rgba(12, 25, 188, 0.1);
}

.btn-add-custom {
    width: 42px;
    min-width: 42px;
    height: auto;
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius-sm);
    background: var(--tw-bg-white);
    color: var(--tw-primary);
    font-size: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--tw-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add-custom:hover {
    border-color: var(--tw-primary);
    background: var(--tw-primary);
    color: white;
}

/* Temperature Preview */
.tonewriter-temperature-preview {
    margin-top: 20px;
    padding: 16px;
    background: var(--tw-bg);
    border-radius: var(--tw-radius-sm);
}

.temperature-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.temperature-label {
    font-size: 0.875rem;
    color: var(--tw-text-light);
}

.temperature-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tw-primary);
}

.temperature-band {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--tw-primary);
    color: white;
}

.temperature-bar {
    height: 8px;
    background: var(--tw-border);
    border-radius: 4px;
    overflow: hidden;
}

.temperature-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #f39c12 50%, #e74c3c 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.temperature-details {
    margin-top: 8px;
}

.temperature-components {
    color: var(--tw-text-light);
    font-size: 0.8rem;
}

.temperature-warnings {
    margin-top: 8px;
}

.temperature-warnings .warning {
    color: var(--tw-warning);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Cluster Status */
.tonewriter-cluster-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--tw-radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.tonewriter-cluster-status.has-reference {
    background: rgba(16, 185, 129, 0.1);
    color: var(--tw-success);
}

.tonewriter-cluster-status.no-reference {
    background: rgba(239, 68, 68, 0.1);
    color: var(--tw-error);
}

/* Text Input */
.tonewriter-textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: var(--tw-transition);
}

.tonewriter-textarea:focus {
    outline: none;
    border-color: var(--tw-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.tonewriter-textarea-small {
    composes: tonewriter-textarea;
    font-size: 0.9rem;
}

.tonewriter-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius-sm);
    font-size: 0.95rem;
    transition: var(--tw-transition);
}

.tonewriter-input:focus {
    outline: none;
    border-color: var(--tw-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* File Upload */
.tonewriter-file-upload {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tonewriter-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px dashed var(--tw-border);
    border-radius: var(--tw-radius-sm);
    color: var(--tw-text-light);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--tw-transition);
}

.tonewriter-upload-btn:hover {
    border-color: var(--tw-primary);
    color: var(--tw-primary);
    background: var(--tw-primary-light);
}

.uploaded-filename {
    color: var(--tw-text-light);
    font-size: 0.875rem;
}

/* Word Count */
.tonewriter-word-count {
    margin-top: 8px;
    text-align: right;
    font-size: 0.8rem;
    color: var(--tw-text-light);
}

/* Buttons */
.tonewriter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--tw-radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--tw-transition);
}

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

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

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

.tonewriter-btn-secondary {
    background: var(--tw-bg);
    color: var(--tw-text);
    border: 1px solid var(--tw-border);
}

.tonewriter-btn-secondary:hover:not(:disabled) {
    background: var(--tw-border);
}

.tonewriter-btn-success {
    background: var(--tw-success);
    color: white;
}

.tonewriter-btn-success:hover:not(:disabled) {
    background: #059669;
}

.tonewriter-btn-text {
    background: transparent;
    color: var(--tw-primary);
    padding: 8px 12px;
}

.tonewriter-btn-text:hover {
    background: rgba(79, 70, 229, 0.05);
}

.tonewriter-btn-large {
    padding: 16px 32px;
    font-size: 1.05rem;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px 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); }
}

/* Agent Sections */
.tonewriter-agent {
    position: relative;
}

.agent-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--tw-border);
}

.agent-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tw-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
}

.agent-header h3 {
    margin: 0;
    flex: 1;
}

.agent-status {
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 12px;
}

.agent-status.status-ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--tw-success);
}

.agent-status.status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--tw-warning);
}

.agent-status.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--tw-error);
}

.agent-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: var(--tw-text-light);
}

.agent-loading .spinner {
    border-color: var(--tw-border);
    border-top-color: var(--tw-primary);
}

/* Validation Results (Agent 2) */
.validation-result {
    padding: 16px;
    border-radius: var(--tw-radius-sm);
}

.validation-result.akkoord {
    background: rgba(16, 185, 129, 0.1);
}

.validation-result.niet-akkoord {
    background: rgba(245, 158, 11, 0.1);
}

.validation-issues {
    margin-top: 12px;
}

.validation-issue {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    padding: 10px 12px;
    background: var(--tw-bg-white);
    border-radius: var(--tw-radius-sm);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.validation-issue .do-not-write {
    color: var(--tw-error);
    text-decoration: line-through;
}

.validation-issue .write-instead {
    color: var(--tw-success);
}

.validation-issue .severity {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--tw-border);
}

.validation-issue .severity.must {
    background: rgba(239, 68, 68, 0.2);
    color: var(--tw-error);
}

/* Analysis Results (Agent 3) */
.scores-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.scores-table th,
.scores-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--tw-border);
}

.scores-table th {
    background: var(--tw-bg);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scores-table .family-cell {
    font-weight: 500;
    color: var(--tw-text-light);
}

.scores-table .axis-label {
    display: flex;
    flex-direction: column;
}

.scores-table .axis-range {
    font-size: 0.75rem;
    color: var(--tw-text-light);
}

.scores-table .score-cell {
    font-weight: 600;
}

.scores-table .score-bar {
    height: 6px;
    background: var(--tw-border);
    border-radius: 3px;
    margin-top: 4px;
    overflow: hidden;
}

.scores-table .score-fill {
    height: 100%;
    background: var(--tw-primary);
    border-radius: 3px;
}

.scores-table .status-ok {
    color: var(--tw-success);
}

.scores-table .status-out {
    color: var(--tw-error);
}

.scores-table .delta-positive {
    color: var(--tw-error);
}

.scores-table .delta-negative {
    color: var(--tw-primary);
}

/* Feedback Results (Agent 4) */
.feedback-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feedback-family {
    background: var(--tw-bg);
    border-radius: var(--tw-radius-sm);
    padding: 16px;
}

.feedback-family h4 {
    margin: 0 0 12px 0;
    color: var(--tw-primary);
    font-size: 0.95rem;
}

.feedback-axis {
    background: var(--tw-bg-white);
    border-radius: var(--tw-radius-sm);
    padding: 12px;
    margin-bottom: 12px;
}

.feedback-axis:last-child {
    margin-bottom: 0;
}

.feedback-axis h5 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: var(--tw-text);
}

.feedback-problem {
    color: var(--tw-text-light);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.feedback-tips {
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
}

.feedback-tips li {
    padding: 6px 0 6px 20px;
    position: relative;
    font-size: 0.9rem;
}

.feedback-tips li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--tw-primary);
}

.feedback-example {
    background: var(--tw-bg);
    padding: 10px 12px;
    border-radius: var(--tw-radius-sm);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.feedback-example .dont {
    color: var(--tw-error);
    text-decoration: line-through;
}

.feedback-example .do {
    color: var(--tw-success);
}

.feedback-motivation {
    color: var(--tw-text-light);
    font-size: 0.85rem;
    font-style: italic;
}

.feedback-closing {
    background: rgba(79, 70, 229, 0.1);
    color: var(--tw-primary);
    padding: 16px;
    border-radius: var(--tw-radius-sm);
    text-align: center;
    font-weight: 500;
}

/* New feedback elements */
.feedback-preserve {
    color: var(--tw-success);
    background: var(--tw-success-bg);
    padding: 8px 12px;
    border-radius: var(--tw-radius-sm);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.feedback-example .direction {
    color: var(--tw-primary);
    font-weight: 500;
}

.feedback-example .feedback-why {
    color: var(--tw-text-light);
    font-size: 0.8rem;
    font-style: italic;
    margin: 4px 0 0 0;
}

.feedback-strong-points {
    background: var(--tw-success-bg);
    border-radius: var(--tw-radius-sm);
    padding: 12px 16px;
    margin-top: 16px;
}

.feedback-strong-points h4 {
    color: var(--tw-success);
    margin: 0 0 8px 0;
    font-size: 0.9rem;
}

.feedback-strong-points ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feedback-strong-points li {
    padding: 4px 0;
    font-size: 0.85rem;
    color: var(--tw-text);
}

.feedback-strong-points li::before {
    content: '✓ ';
    color: var(--tw-success);
}

/* Rewritten Text (Agent 5) */
.rewritten-text-container {
    border: 2px solid var(--tw-success);
    border-radius: var(--tw-radius-sm);
    overflow: hidden;
}

.rewritten-text-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.1);
}

.rewritten-text-header h4 {
    margin: 0;
    color: var(--tw-success);
}

.rewritten-actions {
    display: flex;
    gap: 8px;
}

.rewritten-text-content {
    padding: 20px;
    min-height: 200px;
    line-height: 1.8;
    white-space: pre-wrap;
}

.rewritten-text-content:focus {
    outline: 2px solid var(--tw-primary);
    outline-offset: -2px;
}

.rewritten-text-footer {
    padding: 12px 16px;
    background: var(--tw-bg);
    border-top: 1px solid var(--tw-border);
}

.validation-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.validation-badge.validated {
    color: var(--tw-success);
}

.validation-badge.modified {
    color: var(--tw-warning);
}

.validation-badge.needs-check {
    color: var(--tw-warning);
    background: var(--tw-warning-bg);
    padding: 8px 16px;
    border-radius: var(--tw-radius-sm);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Success Message */
.tonewriter-success-message {
    text-align: center;
    padding: 40px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: var(--tw-radius);
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.tonewriter-success-message h3 {
    color: var(--tw-success);
    margin: 0 0 8px 0;
}

.tonewriter-success-message p {
    color: var(--tw-text);
    margin: 0;
}

/* Report Actions */
.tonewriter-report-actions {
    text-align: center;
    padding: 24px;
    background: var(--tw-bg-white);
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius);
    margin-top: 20px;
}

.tonewriter-report-actions .btn-download-pdf {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tonewriter-report-actions .btn-download-pdf .dashicons {
    font-size: 18px;
}

/* Error Message */
.tonewriter-error {
    text-align: center;
    padding: 32px 24px;
    background: var(--tw-bg-white);
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius);
    max-width: 600px;
    margin: 0 auto;
}

.tonewriter-error::before {
    content: "⚠️";
    display: block;
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.error-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.error-message,
.tonewriter-error p {
    color: var(--tw-text);
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

/* Lexicon Editor */
.lexicon-entries {
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius-sm);
    overflow: hidden;
}

.lexicon-header {
    display: grid;
    grid-template-columns: 1fr 1fr 40px;
    gap: 12px;
    padding: 10px 12px;
    background: var(--tw-bg);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lexicon-rows {
    max-height: 200px;
    overflow-y: auto;
}

.lexicon-row {
    display: grid;
    grid-template-columns: 1fr 1fr 40px;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--tw-border);
}

.lexicon-row:last-child {
    border-bottom: none;
}

.lexicon-row input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--tw-border);
    border-radius: 4px;
    font-size: 0.9rem;
}

.lexicon-row .btn-remove {
    width: 28px;
    height: 28px;
    padding: 0;
    background: none;
    border: none;
    color: var(--tw-text-light);
    cursor: pointer;
    border-radius: 4px;
}

.lexicon-row .btn-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--tw-error);
}

.btn-add-lexicon,
.btn-add-rule {
    width: 100%;
    padding: 10px;
    border-top: 1px solid var(--tw-border);
}

/* Writing Rules */
.writing-rules {
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius-sm);
}

.rules-rows {
    max-height: 200px;
    overflow-y: auto;
}

.rule-row {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--tw-border);
}

.rule-row:last-child {
    border-bottom: none;
}

.rule-row textarea {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--tw-border);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

/* Modal */
.tonewriter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: var(--tw-bg-white);
    border-radius: var(--tw-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--tw-shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--tw-border);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--tw-text-light);
    cursor: pointer;
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--tw-bg);
    color: var(--tw-text);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--tw-border);
    background: var(--tw-bg);
}

.field-group {
    margin-bottom: 16px;
}

.field-group:last-child {
    margin-bottom: 0;
}

.field-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.field-group-inline {
    display: flex;
    align-items: center;
}

.field-group-inline label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    cursor: pointer;
}

/* Range Input */
input[type="range"] {
    width: 100%;
    margin: 8px 0;
}

.temperature-display {
    display: inline-block;
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: var(--tw-primary);
}

/* Admin Specific Styles */
.tonewriter-admin-app .tonewriter-header {
    background: linear-gradient(135deg, var(--tw-primary) 0%, #7C3AED 100%);
    margin: -20px -20px 40px -20px;
    padding: 40px 20px;
    border-radius: 0;
}

.tonewriter-admin-app .tonewriter-title {
    color: white;
}

.tonewriter-admin-app .tonewriter-subtitle {
    color: rgba(255,255,255,0.8);
}

.tonewriter-admin-app .admin-badge {
    background: rgba(255,255,255,0.2);
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--tw-border);
}

.result-cluster-info,
.result-temperature {
    margin-bottom: 12px;
}

.result-cluster-info .cluster-id,
.result-temperature .temperature-value {
    font-weight: 600;
    color: var(--tw-primary);
}

/* Admin Success */
.tonewriter-admin-success {
    text-align: center;
    padding: 60px 40px;
}

.tonewriter-admin-success .success-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tw-success);
    color: white;
    font-size: 2.5rem;
    border-radius: 50%;
    margin: 0 auto 24px;
}

.tonewriter-admin-success h3 {
    color: var(--tw-success);
    margin: 0 0 12px 0;
}

.tonewriter-admin-success p {
    color: var(--tw-text-light);
    margin: 0 0 24px 0;
}

/* Responsive */
@media (max-width: 640px) {
    .tonewriter-app {
        padding: 8px;
    }
    
    .tonewriter-section {
        padding: 16px 12px;
        border-radius: 12px;
    }
    
    .tonewriter-hero-section {
        border-radius: 12px;
    }
    
    .tonewriter-section-header {
        padding: 24px 16px;
        margin: -16px -12px 20px -12px;
    }
    
    .tonewriter-section-header .tonewriter-title {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 8px;
    }
    
    .tonewriter-section-header .tonewriter-subtitle {
        font-size: 0.9rem;
    }
    
    .tonewriter-section h3 {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .tonewriter-dropdown-group label {
        font-size: 0.8rem;
    }
    
    .tonewriter-select {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .btn-add-custom {
        width: 38px;
        min-width: 38px;
    }
    
    .tonewriter-textarea {
        min-height: 120px;
        font-size: 0.9rem;
    }
    
    .tonewriter-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .validation-issue {
        grid-template-columns: 1fr;
    }
    
    .scores-table {
        font-size: 0.75rem;
    }
    
    .scores-table th,
    .scores-table td {
        padding: 6px 8px;
    }
    
    .agent-card {
        padding: 16px 12px;
    }
    
    .agent-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .agent-info h4 {
        font-size: 0.95rem;
    }
    
    .rewritten-text-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .rewritten-actions {
        width: 100%;
    }
    
    .rewritten-actions .tonewriter-btn {
        flex: 1;
    }
    
    .tonewriter-error {
        padding: 24px 16px;
        margin: 0 4px;
    }
    
    .tonewriter-error::before {
        font-size: 2rem;
    }
}

/* Image Upload */
.tonewriter-image-upload {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tonewriter-upload-btn-secondary {
    border-style: dashed;
    background: transparent;
}

.tonewriter-upload-btn-secondary:hover {
    background: var(--tw-primary-light);
}

.uploaded-imagename {
    color: var(--tw-success);
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-remove-image {
    width: 24px;
    height: 24px;
    padding: 0;
    background: var(--tw-error);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--tw-transition);
}

.btn-remove-image:hover {
    background: #dc2626;
}

.tonewriter-image-preview {
    margin-top: 12px;
    border: 1px solid var(--tw-border);
    border-radius: var(--tw-radius-sm);
    padding: 8px;
    background: var(--tw-bg);
}

.tonewriter-image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 4px;
    display: block;
}

.tonewriter-image-hint {
    margin-top: 8px !important;
}

/* Visual Diff Styles for Copywritor */
.diff-added {
    color: #047857;
    background-color: rgba(16, 185, 129, 0.15);
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

.diff-removed {
    color: #dc2626;
    background-color: rgba(239, 68, 68, 0.1);
    padding: 1px 2px;
    border-radius: 2px;
    text-decoration: line-through;
}

.diff-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--tw-bg);
    border-radius: var(--tw-radius-sm);
    font-size: 0.85rem;
}

.diff-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.diff-legend-item .diff-example {
    padding: 2px 6px;
    border-radius: 3px;
}

/* Success message for rewritten text that meets criteria */
.tonewriter-rewrite-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid #10B981;
    border-radius: var(--tw-radius);
    padding: 24px;
    text-align: center;
    margin-top: 16px;
}

.tonewriter-rewrite-success .success-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.tonewriter-rewrite-success h4 {
    color: #047857;
    margin: 0 0 8px 0;
    font-size: 1.1rem;
}

.tonewriter-rewrite-success p {
    color: #065f46;
    margin: 0;
    font-size: 0.95rem;
}

/* Iterating indicator */
.rewrite-iterating {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-radius: var(--tw-radius-sm);
    color: #c2410c;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.rewrite-iterating .spinner {
    animation: spin 1s linear infinite;
}

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