/**
 * OTA 日志分析工具 - 样式
 */

:root {
    --primary: #2563eb;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ca8a04;
    --secondary: #6b7280;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 24px;
}

header h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card h2 {
    font-size: 18px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 日志列表 */
.log-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 12px;
}

.log-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    border-radius: 4px;
}

.log-item:hover {
    background: #f1f5f9;
}

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

.log-item input {
    width: auto;
    margin: 0;
}

.log-name {
    flex: 1;
    font-size: 13px;
    font-family: 'Consolas', monospace;
}

.log-meta {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 120px;
    text-align: right;
}

.log-size {
    min-width: 60px;
}

/* 操作按钮 */
.actions {
    display: flex;
    gap: 8px;
}

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-sm { padding: 4px 8px; font-size: 12px; }

/* 报告内容 */
.report-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.report-item {
    padding: 12px;
    background: #f8fafc;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.report-item h3 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.report-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
}

.report-list {
    list-style: none;
    font-size: 13px;
}

.report-list li {
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

.report-list li:last-child {
    border-bottom: none;
}

/* 详细结果网格 */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.result-item {
    padding: 12px;
    background: #f8fafc;
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
}

.result-item:hover {
    border-color: var(--primary);
}

.result-item.success {
    border-left: 3px solid var(--success);
}

.result-item.failed {
    border-left: 3px solid var(--danger);
}

.result-file {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    word-break: break-all;
}

.result-vin {
    font-size: 12px;
    color: var(--text-muted);
}

.result-errors {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

/* 响应输出 */
.response-output {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    max-height: 500px;
    overflow: auto;
    white-space: pre-wrap;
}

/* 辅助类 */
.text-muted {
    color: var(--text-muted);
}

/* 标签 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #16a34a; }
.badge-error { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef3c7; color: #ca8a04; }

.protocol-switch {
    display: inline-flex;
    gap: 8px;
    padding: 6px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 999px;
    margin-bottom: 20px;
}

.mode-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.mode-btn.active {
    background: var(--primary);
    color: white;
}

.mode-hint {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.result-item.pending {
    border-left: 3px solid var(--warning);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill.success {
    background: #dcfce7;
    color: #166534;
}

.status-pill.failed {
    background: #fee2e2;
    color: #b91c1c;
}

.status-pill.pending {
    background: #fef3c7;
    color: #a16207;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 60px 20px;
}

.hero-section h1 {
    font-size: 28px;
    margin-bottom: 12px;
}

.hero-section .subtitle {
    font-size: 16px;
    margin-bottom: 32px;
}

.hero-section .btn-large {
    padding: 12px 32px;
    font-size: 16px;
}

.hero-section .features {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.feature {
    max-width: 200px;
}

.feature h4 {
    margin-bottom: 8px;
    color: var(--primary);
}

.feature p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Loading */
#loading {
    display: none;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading p {
    margin-top: 16px;
}

/* Results Section */
#results-section {
    display: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow: auto;
}

.modal-content {
    background: white;
    margin: 20px auto;
    padding: 20px;
    max-width: 900px;
    border-radius: 8px;
    position: relative;
}

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

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

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

/* 详情区域 */
#detail-section {
    border: 2px solid var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

#detail-section h2 {
    flex-wrap: wrap;
    gap: 12px;
}

#detail-section .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 标签页 */
.tab-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px 4px 0 0;
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-btn:hover:not(.active) {
    background: #e2e8f0;
}

.tab-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab-panel {
    display: none;
}

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

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: var(--primary);
    color: white;
    margin-left: 4px;
}

/* 服务器交互列表 */
.interaction-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.interactions-list {
    max-height: 600px;
    overflow-y: auto;
}

.interaction-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 12px;
    overflow: hidden;
}

.interaction-item.error {
    border-left: 3px solid var(--danger);
}

.interaction-item.success {
    border-left: 3px solid var(--success);
}

.interaction-item.warning {
    border-left: 3px solid var(--warning);
}

.interaction-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f1f5f9;
    cursor: pointer;
    font-size: 13px;
}

.interaction-header:hover {
    background: #e2e8f0;
}

.interaction-index {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 60px;
}

.interaction-type {
    font-size: 16px;
}

.interaction-time {
    color: var(--text-muted);
    font-family: 'Consolas', monospace;
}

.interaction-url {
    flex: 1;
    color: var(--primary);
    word-break: break-all;
}

.interaction-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.interaction-status.success {
    background: #dcfce7;
    color: #16a34a;
}

.interaction-status.error {
    background: #fee2e2;
    color: #dc2626;
}

.interaction-status.warning {
    background: #fef3c7;
    color: #a16207;
}

.interaction-body {
    padding: 12px;
    background: white;
    border-top: 1px solid var(--border);
}

.interaction-body pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

.interaction-actions {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

.interaction-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

.interaction-note {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    word-break: break-all;
}
