/* EPSleuth Web UI Styles */

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #242836;
    --border: #2e3348;
    --text: #e4e6ed;
    --text-muted: #8b8fa3;
    --accent: #6c8cff;
    --accent-hover: #5a7aef;
    --success: #4caf7d;
    --error: #e06060;
    --warning: #e0a040;
    --radius: 8px;
    --font-mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

* {
    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;
    min-height: 100vh;
}

/* Layout */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

header h1 span {
    color: var(--accent);
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.3rem;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

/* Upload Section */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 1rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: rgba(108, 140, 255, 0.05);
}

.upload-area.has-file {
    border-color: var(--success);
    border-style: solid;
}

.upload-area .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.upload-area .filename {
    color: var(--success);
    font-weight: 500;
    font-size: 0.95rem;
}

.upload-area .hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

input[type="file"] {
    display: none;
}

/* Names Textarea */
.names-section {
    margin-top: 1rem;
}

.names-section label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}

textarea {
    width: 100%;
    height: 180px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    resize: vertical;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
}

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

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

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

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

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Progress Section */
#progress-section {
    display: none;
}

.progress-bar-container {
    background: var(--bg);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.log-output {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
}

.log-output .log-error {
    color: var(--error);
}

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

.downloads {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: border-color 0.2s, background 0.2s;
}

.download-link:hover {
    border-color: var(--accent);
    background: rgba(108, 140, 255, 0.08);
}

/* Box Result Cards */
.box-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

.box-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.box-id {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

.box-best-name {
    font-weight: 600;
    font-size: 1rem;
}

.box-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 4px;
}

.box-preview .redacted {
    color: var(--accent);
    font-weight: 600;
}

.candidates-list {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.candidate-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.2rem 0;
}

.candidate-name {
    min-width: 150px;
    font-family: var(--font-mono);
}

.candidate-bar-bg {
    flex: 1;
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    overflow: hidden;
}

.candidate-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.candidate-score {
    font-family: var(--font-mono);
    min-width: 50px;
    text-align: right;
}

/* Debug Images Gallery */
.debug-gallery {
    margin-top: 0.75rem;
}

.debug-toggle {
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.debug-toggle:hover {
    color: var(--accent);
}

.debug-images {
    display: none;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.debug-images.open {
    display: flex;
}

.debug-images img {
    max-width: 100%;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* Summary Stats */
.stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.stat {
    background: var(--bg);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.stat .label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat .value {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    .downloads {
        flex-direction: column;
    }
    .candidate-name {
        min-width: 100px;
    }
}
