/* Primary button */
.btn-primary {
    background: #999;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.btn-primary:hover {
    background: #444;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Small buttons */
.btn-small {
    background: #999;
    color: white;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-small:hover {
    background: #444;
}

.btn-small.copied {
    background: #333;
}

/* Button row */
.btn-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* Tabs */
.tab-bar {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    color: #777;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #444;
    border-bottom-color: #444;
    font-weight: bold;
}

.tab-panel {
    display: none;
    padding: 16px 0;
}

.tab-panel.active {
    display: block;
}

/* Plain text output */
.plain-text-output {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 24px 28px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.75;
    color: #333;
    max-height: 400px;
    overflow-y: auto;
}

.plain-text-output p {
    margin: 0 0 14px 0;
}

.plain-text-output p:last-child {
    margin-bottom: 0;
}

.plain-text-output ol,
.plain-text-output ul {
    margin: 0 0 14px 0;
    padding-left: 24px;
}

.plain-text-output li {
    margin-bottom: 6px;
}

/* Code blocks — dark theme for JSON */
.tab-panel pre {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
}

/* Loading */
.loading-container {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ddd;
    border-top-color: #999;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-text {
    color: #666;
    font-size: 14px;
}

.loading-status {
    color: #999;
    font-size: 13px;
    margin-top: 8px;
}

/* Output section */
.output-section {
    margin-top: 24px;
}

.output-section h3 {
    margin-bottom: 12px;
    color: #333;
}

/* JSON syntax highlighting */
.json-key {
    color: #9cdcfe;
}

.json-string {
    color: #ce9178;
}

.json-number {
    color: #b5cea8;
}

.json-keyword {
    color: #569cd6;
}

/* Section divider */
.section-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

/* Slow loading hint */
.slow-hint {
    margin-top: 16px;
    font-size: 13px;
    color: #888;
}

.slow-hint a {
    color: #555;
    text-decoration: underline;
    cursor: pointer;
}

.slow-hint a:hover {
    color: #333;
}

/* Small modal variant */
.modal-small {
    max-width: 480px;
}

/* OS tab switcher */
.os-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #ddd;
    margin: 16px 0 0 0;
}

.os-tab-btn {
    background: none;
    border: none;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    color: #777;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.os-tab-btn:hover {
    color: #333;
}

.os-tab-btn.active {
    color: #444;
    border-bottom-color: #444;
}

.os-panel {
    display: none;
    padding: 12px 0 4px 0;
}

.os-panel.active {
    display: block;
}

/* Terminal command blocks */
.terminal-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-family: monospace;
    overflow-x: auto;
    margin: 8px 0;
    user-select: all;
}

/* Ollama settings hint row */
.ollama-hint-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ollama-hint-row .settings-hint {
    margin: 0;
    flex: 1;
}

/* Share buttons */
.share-idea-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.share-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.btn-share-option {
    background: #999;
    color: white;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.btn-share-option:hover {
    background: #444;
}

.share-status {
    margin-top: 12px;
    font-size: 13px;
    color: #333;
    font-weight: bold;
}

/* ===================== */
/* Detection-specific    */
/* ===================== */

/* Detection badge */
.detection-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.detection-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    flex-shrink: 0;
    color: white;
}

.detection-score {
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
}

.detection-label {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 4px;
    text-transform: uppercase;
}

.classification-human { background: linear-gradient(135deg, #2e7d32, #4caf50); }
.classification-ai { background: linear-gradient(135deg, #c62828, #e53935); }
.classification-collaboration { background: linear-gradient(135deg, #f57c00, #ff9800); }

.detection-summary-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.7;
    color: #444;
    padding-top: 4px;
}

/* Confidence bar */
.confidence-section {
    margin-bottom: 24px;
}

.confidence-bar-container {
    margin-bottom: 12px;
}

.confidence-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    margin-bottom: 6px;
}

.confidence-bar {
    display: flex;
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    background: #eee;
}

.confidence-segment {
    transition: width 0.5s ease;
}

.confidence-human {
    background: linear-gradient(90deg, #2e7d32, #4caf50);
}

.confidence-ai {
    background: linear-gradient(90deg, #e53935, #c62828);
}

.confidence-percentages {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: bold;
    margin-top: 6px;
}

.confidence-percentages span:first-child {
    color: #2e7d32;
}

.confidence-percentages span:last-child {
    color: #c62828;
}

.confidence-note {
    background: #f5f5f5;
    border-left: 4px solid #999;
    padding: 12px 16px;
    border-radius: 0 4px 4px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.confidence-note strong {
    color: #444;
}

/* Analysis sections */
.analysis-section {
    margin-bottom: 20px;
}

.analysis-section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    font-weight: bold;
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}

.analysis-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.analysis-item:last-child {
    border-bottom: none;
}

.item-icon {
    flex-shrink: 0;
    margin-top: 1px;
    font-size: 15px;
}

.ai-icon { color: #c62828; }
.human-icon { color: #2e7d32; }
.reasoning-icon { color: #1565c0; }

/* Reasoning item */
.reasoning-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #1565c0;
    border-radius: 0 6px 6px 0;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.reasoning-title {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
}

.reasoning-detail {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}

/* Highlighted content */
.highlighted-content {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 24px 28px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    max-height: 500px;
    overflow-y: auto;
}

.highlight-ai {
    background: linear-gradient(to bottom, rgba(229, 57, 53, 0.15), rgba(229, 57, 53, 0.25));
    border-bottom: 2px solid #e53935;
    padding: 2px 4px;
    border-radius: 2px;
    cursor: help;
}

.highlight-human {
    background: linear-gradient(to bottom, rgba(46, 125, 50, 0.15), rgba(46, 125, 50, 0.25));
    border-bottom: 2px solid #2e7d32;
    padding: 2px 4px;
    border-radius: 2px;
    cursor: help;
}

.highlight-collaboration {
    background: linear-gradient(to bottom, rgba(255, 152, 0, 0.15), rgba(255, 152, 0, 0.25));
    border-bottom: 2px solid #ff9800;
    padding: 2px 4px;
    border-radius: 2px;
    cursor: help;
}

.highlights-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.legend-ai {
    background: linear-gradient(to bottom, rgba(229, 57, 53, 0.3), rgba(229, 57, 53, 0.5));
    border: 1px solid #e53935;
}

.legend-human {
    background: linear-gradient(to bottom, rgba(46, 125, 50, 0.3), rgba(46, 125, 50, 0.5));
    border: 1px solid #2e7d32;
}

.legend-collaboration {
    background: linear-gradient(to bottom, rgba(255, 152, 0, 0.3), rgba(255, 152, 0, 0.5));
    border: 1px solid #ff9800;
}

/* Attestation section */
.attest-section {
    margin-top: 24px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: left;
}

.attest-section h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 16px;
}

.attest-section p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

.attest-section .btn-small {
    display: inline-block;
    text-decoration: none;
}

/* Raw text for copy/download — hidden */
.raw-data {
    display: none;
}

/* Context textarea label inline optional text */
.label-optional {
    font-weight: normal;
    color: #999;
    font-size: 12px;
}

@media (max-width: 600px) {
    .tab-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    .btn-row {
        flex-direction: column;
    }

    .detection-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .highlights-legend {
        flex-direction: column;
        gap: 8px;
    }
}
