/* 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 — for optimized version */
.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;
}

/* Optimization notes */
.optimization-notes {
    background: #f5f5f5;
    border-left: 4px solid #999;
    padding: 12px 16px;
    border-radius: 0 4px 4px 0;
    margin-top: 16px;
    font-size: 13px;
    color: #999;
}

.optimization-notes strong {
    display: block;
    margin-bottom: 4px;
}

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

.json-string {
    color: #ce9178;
}

.json-number {
    color: #b5cea8;
}

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

/* Open in model buttons */
.open-in-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.open-in-section h4 {
    margin: 0 0 12px 0;
    color: #555;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.open-in-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-open-in {
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-open-in:hover {
    background: #444;
    transform: translateY(-1px);
}

.btn-open-in:active {
    transform: translateY(0);
}

.btn-chatgpt,
.btn-claude,
.btn-copilot,
.btn-gemini {
    background: #999;
}

/* Clipboard toast modal */
.clipboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.clipboard-modal-content {
    background: #fff;
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.25s ease;
    position: relative;
}

.clipboard-modal-content .btn-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
}

.clipboard-modal-content p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
}

.clipboard-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
}

.clipboard-modal-actions .btn-primary {
    width: auto;
}

.clipboard-modal-actions .btn-small {
    background: #ddd;
    color: #555;
}

.clipboard-modal-actions .btn-small:hover {
    background: #ccc;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 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 prompt row above assess button */
.share-idea-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

/* Share modal options */
.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;
}

/* ===================== */
/* Assessment-specific   */
/* ===================== */

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

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

.score-value {
    font-size: 26px;
    font-weight: bold;
    line-height: 1;
}

.score-grade {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 2px;
}

.score-badge.grade-a { background: #2e7d32; }
.score-badge.grade-b { background: #558b2f; }
.score-badge.grade-c { background: #f57c00; }
.score-badge.grade-d { background: #d84315; }
.score-badge.grade-f { background: #c62828; }

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

/* Assessment sections */
.assessment-section {
    margin-bottom: 20px;
}

.assessment-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;
}

.assessment-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;
}

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

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

.strength-icon { color: #2e7d32; }
.issue-icon { color: #c62828; }
.missing-icon { color: #e65100; }

/* Suggestions tab */
.suggestion-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #999;
    border-radius: 0 6px 6px 0;
    padding: 14px 16px;
    margin-bottom: 12px;
}

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

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

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

/* Cost estimate tab */
.token-summary {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.token-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.cost-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cost-table th {
    background: #f5f5f5;
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #666;
    border-bottom: 2px solid #ddd;
    white-space: nowrap;
}

.cost-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    vertical-align: middle;
}

.cost-table tbody tr:last-child td {
    border-bottom: none;
}

.cost-table tbody tr:hover td {
    background: #fafafa;
}

.cost-provider {
    font-weight: 600;
    color: #555;
}

.cost-model {
    color: #333;
}

.cost-value {
    font-family: monospace;
    font-size: 12px;
    color: #1565c0;
    font-weight: 600;
}

.cost-table-group-header td {
    background: #f9f9f9;
    font-weight: bold;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #888;
    padding: 6px 12px;
}

.self-hosted-note {
    background: #f5f5f5;
    border-left: 4px solid #999;
    padding: 12px 16px;
    border-radius: 0 4px 4px 0;
    margin-top: 16px;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}

/* 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;
    }

    .open-in-row {
        flex-direction: column;
    }

    .btn-open-in {
        width: 100%;
        text-align: center;
    }

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

    .cost-table th,
    .cost-table td {
        padding: 6px 8px;
        font-size: 12px;
    }

    .cost-table th:nth-child(4),
    .cost-table td:nth-child(4) {
        display: none;
    }
}

/* Compliance Modal */
.modal-compliance {
    max-width: 520px;
}

.modal-header-warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.modal-header-warning .btn-modal-close {
    color: white;
}

.modal-header-warning .btn-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.compliance-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

.compliance-reason {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #e65100;
    border-radius: 0 4px 4px 0;
}

.compliance-help {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 12px 0;
}

.compliance-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.compliance-actions .btn-primary {
    flex: 1;
    min-width: 160px;
}

.compliance-actions .btn-secondary {
    flex: 0 0 auto;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.compliance-actions .btn-secondary:hover {
    background: #eee;
}

.compliance-fixing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    background: #f0f7ff;
    border-radius: 6px;
    color: #1976d2;
    font-size: 14px;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid #e3f2fd;
    border-top-color: #1976d2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@media (max-width: 600px) {
    .modal-compliance {
        margin: 16px;
        max-width: calc(100% - 32px);
    }

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

    .compliance-actions .btn-primary,
    .compliance-actions .btn-secondary {
        width: 100%;
    }

    .compliance-icon {
        font-size: 36px;
    }
}
