/* APIsec MCP Discovery and Audit - Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Results section needs full width */
#results-section {
    max-width: 100%;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

header .subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--surface);
}

/* Tab Content */
.tab-content {
    display: none;
    padding-top: 1.5rem;
}

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

.tab-description {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

/* Source Tiles */
.source-tiles {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.source-tile {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.source-tile.available:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.source-tile.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}

.tile-icon {
    color: var(--text);
    margin-bottom: 0.75rem;
}

.source-tile.available .tile-icon {
    color: var(--primary);
}

.tile-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.tile-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.source-tile.available .tile-status {
    color: var(--success);
}

.source-tile.coming-soon .tile-status {
    color: var(--text-muted);
}

/* Scan Section */
.scan-section {
    animation: fadeIn 0.3s ease;
}

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

.back-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.back-btn:hover {
    text-decoration: underline;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.card p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.card ul {
    color: var(--text-muted);
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.card li {
    margin-bottom: 0.5rem;
}

/* Forms */
.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.input-group small a {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

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

.btn.secondary {
    background: var(--secondary);
    color: white;
}

.btn.secondary:hover:not(:disabled) {
    background: #475569;
}

.btn.outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn.outline:hover:not(:disabled) {
    background: var(--background);
}

/* Status */
.status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

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

.status.error {
    background: #fee2e2;
    color: #991b1b;
}

.status.info {
    background: #dbeafe;
    color: #1e40af;
}

/* Progress */
.progress-container {
    margin: 1rem 0;
}

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

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    text-align: center;
    margin-top: 0.5rem;
    color: var(--text-muted);
}

.scan-log {
    max-height: 200px;
    overflow-y: auto;
    background: #1e293b;
    color: #94a3b8;
    padding: 1rem;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.scan-log .log-entry {
    margin-bottom: 0.25rem;
}

.scan-log .log-entry.success {
    color: #4ade80;
}

.scan-log .log-entry.warning {
    color: #fbbf24;
}

.scan-log .log-entry.error {
    color: #f87171;
}

/* Summary */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-item {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}

.summary-item .value {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--primary);
}

.summary-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.summary-item.warning .value {
    color: var(--warning);
}

.summary-item.danger .value {
    color: var(--danger);
}

.summary-item.success .value {
    color: var(--success);
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th, td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    background: var(--background);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    white-space: nowrap;
}

td {
    font-size: 0.85rem;
}

/* Column widths */
table th:nth-child(1),
table td:nth-child(1) { width: 14%; } /* MCP Name */
table th:nth-child(2),
table td:nth-child(2) { width: 22%; } /* Description */
table th:nth-child(3),
table td:nth-child(3) { width: 20%; } /* Source */
table th:nth-child(4),
table td:nth-child(4) { width: 12%; } /* Repository */
table th:nth-child(5),
table td:nth-child(5) { width: 8%; }  /* Known */
table th:nth-child(6),
table td:nth-child(6) { width: 10%; } /* Risk */
table th:nth-child(7),
table td:nth-child(7) { width: 14%; } /* Risk Flags */

td code {
    background: #f1f5f9;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    font-size: 0.75rem;
    word-break: break-all;
    display: inline-block;
    max-width: 100%;
}

td.description-cell {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

td.name-cell {
    font-weight: 600;
    word-break: break-word;
}

tr:hover {
    background: var(--background);
}

/* Risk flags */
.risk-flag {
    display: inline-block;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 500;
    margin-right: 0.2rem;
    margin-bottom: 0.2rem;
    white-space: nowrap;
}

.risk-flag.high {
    background: #fee2e2;
    color: #991b1b;
}

.risk-flag.medium {
    background: #fef3c7;
    color: #92400e;
}

.risk-flag.low {
    background: #e0e7ff;
    color: #3730a3;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge.success {
    background: #dcfce7;
    color: #166534;
}

.badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge.info {
    background: #dbeafe;
    color: #1e40af;
}

.badge.secondary {
    background: #f1f5f9;
    color: #475569;
}

/* Actions */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Local Audit Tab */
.local-audit-content {
    display: grid;
    gap: 1.5rem;
}

.feature-list {
    list-style: none;
    margin: 0 0 1.5rem 0;
    padding: 0;
}

.feature-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

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

.download-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius);
}

.download-btn {
    font-size: 1rem;
}

.download-size {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Install Steps */
.install-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    margin-bottom: 0.25rem;
}

.step-content p {
    margin: 0;
    color: var(--text-muted);
}

.step-content code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
}

.requirements {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.requirements p {
    margin-bottom: 0.5rem;
}

/* Command List */
.command-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.command {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.command code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    display: inline-block;
    width: fit-content;
}

.command span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.command-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.command-details p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
    padding-left: 0.5rem;
    line-height: 1.5;
}

.command-details p::before {
    content: "•";
    color: var(--primary);
    margin-right: 0.5rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

footer a {
    color: var(--primary);
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .tab-btn.active {
        border-bottom: none;
        border-left-color: var(--primary);
    }

    .source-tiles {
        grid-template-columns: repeat(3, 1fr);
    }

    .actions {
        flex-direction: column;
    }

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

    .download-box {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .source-tiles {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
