/* RAG Scanner Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 32px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 16px;
}

/* Input Section */
.input-section { margin-bottom: 20px; }

.input-label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.input-hint {
    color: #999;
    font-size: 12px;
    margin-bottom: 8px;
}

#inputBox {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Monaco', 'Consolas', monospace;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.3s;
}

#inputBox:focus {
    outline: none;
    border-color: #667eea;
}

/* Preview Section */
.preview-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    display: none;
}

.preview-title {
    color: #333;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-title .icon { color: #667eea; }

.preview-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.preview-row:last-child { margin-bottom: 0; }

.preview-label {
    color: #666;
    font-size: 14px;
    min-width: 70px;
}

.preview-value {
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.preview-value.url {
    color: #667eea;
    word-break: break-all;
}

/* Select & Input */
#paramSelect, #customParam, #authToken {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

#paramSelect:focus, #customParam:focus, #authToken:focus {
    outline: none;
    border-color: #667eea;
}

#customParam { width: 120px; display: none; }
#authToken { width: 300px; display: none; }

/* Input Type Badge */
.input-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.input-type-badge.curl { background: #c6f6d5; color: #276749; }
.input-type-badge.url { background: #bee3f8; color: #2b6cb0; }

/* Auth Hint */
.auth-hint { font-size: 12px; }
.auth-from-curl { color: #38a169; }
.auth-needed { color: #dd6b20; }

/* Button */
.btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    margin-bottom: 20px;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Progress */
.progress-container { margin-bottom: 20px; display: none; }

.progress-bar {
    height: 24px;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Result */
.result-container { display: none; }

.score-card {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 20px;
}

.score-number {
    font-size: 72px;
    font-weight: bold;
}

.score-level {
    font-size: 24px;
    margin-top: 10px;
    color: #666;
}

/* Vulnerabilities */
.vulnerabilities { margin-bottom: 20px; }

.vuln-item {
    padding: 16px;
    background: #fff5f5;
    border-left: 4px solid #fc8181;
    border-radius: 8px;
    margin-bottom: 12px;
}

.vuln-item.critical { border-left-color: #c53030; background: #fff5f5; }
.vuln-item.high { border-left-color: #dd6b20; background: #fffaf0; }
.vuln-item.medium { border-left-color: #d69e2e; background: #fffff0; }
.vuln-item.low { border-left-color: #38a169; background: #f0fff4; }

.vuln-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.vuln-name { font-weight: 600; color: #333; }

.vuln-severity {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.severity-critical { background: #fed7d7; color: #c53030; }
.severity-high { background: #feebc8; color: #c05621; }
.severity-medium { background: #fefcbf; color: #975a16; }
.severity-low { background: #c6f6d5; color: #276749; }

.download-btn {
    display: inline-block;
    padding: 12px 30px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
}

/* Features */
.features {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.features h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.feature-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
}

.feature-icon { font-size: 24px; margin-bottom: 6px; }
.feature-name { font-weight: 600; color: #333; }

/* Error Message */
.error-msg {
    color: #e53e3e;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

/* History Section */
.history-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.history-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    color: #333;
    font-weight: 600;
    font-size: 18px;
}

.refresh-btn-sm {
    padding: 6px 12px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.refresh-btn-sm:hover {
    background: #e0e0e0;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.history-item:hover {
    background: #e8e9ea;
}

.history-info {
    flex: 1;
    overflow: hidden;
}

.history-target {
    display: block;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    display: block;
    color: #999;
    font-size: 12px;
    margin-top: 4px;
}

.history-result {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-score {
    font-size: 16px;
    font-weight: 600;
}

.history-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-completed { background: #c6f6d5; color: #276749; }
.status-running { background: #bee3f8; color: #2b6cb0; }
.status-queued { background: #fefcbf; color: #975a16; }
.status-failed { background: #fed7d7; color: #c53030; }

.empty-history {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

.loading-text {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

.error-text {
    text-align: center;
    color: #e53e3e;
    padding: 20px;
    font-size: 14px;
}