/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #fafaf9;
    --surface: #ffffff;
    --border: #e5e5e4;
    --border-hover: #d4d4d3;
    --text: #1c1917;
    --text-secondary: #78716c;
    --text-tertiary: #a8a29e;
    --accent: #1c1917;
    --accent-hover: #292524;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --processing: #2563eb;
    --processing-bg: #eff6ff;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Header === */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

header h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.security-badge {
    font-size: 12px;
    font-weight: 500;
    color: var(--success);
    background: var(--success-bg);
    padding: 4px 10px;
    border-radius: 100px;
    border: 1px solid #bbf7d0;
}

/* === Main === */
main {
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 24px;
}

/* === Drop Zone === */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--surface);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: #f5f5f4;
}

.drop-zone.drag-over {
    border-style: solid;
}

.upload-icon {
    width: 40px;
    height: 40px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.drop-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.drop-subtext {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
}

.supported-types {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: 'SF Mono', SFMono-Regular, Menlo, monospace;
}

/* === File Queue === */
.file-queue {
    margin-top: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.queue-header h2 {
    font-size: 14px;
    font-weight: 600;
}

.queue-actions {
    display: flex;
    gap: 8px;
}

.file-list {
    list-style: none;
    max-height: 320px;
    overflow-y: auto;
}

.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

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

.file-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 12px;
}

.file-size {
    color: var(--text-tertiary);
    font-size: 12px;
    font-family: 'SF Mono', SFMono-Regular, Menlo, monospace;
    flex-shrink: 0;
}

.file-ext {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 10px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.file-remove {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.file-remove:hover { color: var(--error); background: var(--error-bg); }

/* === Buttons === */
.btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

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

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

.btn-ghost:hover { background: var(--bg); border-color: var(--border-hover); }

.btn-sm {
    font-size: 12px;
    padding: 4px 10px;
}

/* === Job Summary Card === */
.job-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: var(--surface);
}

.summary-value {
    font-size: 24px;
    font-weight: 600;
    font-family: 'SF Mono', SFMono-Regular, Menlo, monospace;
    line-height: 1.2;
}

.summary-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.summary-value.status-text-processing { color: var(--processing); }
.summary-value.status-text-completed { color: var(--success); }
.summary-value.status-text-partial { color: var(--warning); }
.summary-value.status-text-failed { color: var(--error); }

/* === Results === */
#results-section {
    margin-top: 32px;
}

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

.results-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.results-actions {
    display: flex;
    gap: 8px;
}

.results-table {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    font-size: 14px;
}

.results-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.results-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

/* Status badges */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 100px;
}

.status-queued { color: var(--text-tertiary); background: var(--bg); }
.status-processing { color: var(--processing); background: var(--processing-bg); }
.status-completed { color: var(--success); background: var(--success-bg); }
.status-failed { color: var(--error); background: var(--error-bg); }

.status-processing::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--processing);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.redaction-count {
    font-family: 'SF Mono', SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}

.flagged-count {
    color: var(--warning);
    font-weight: 500;
}

/* Flagged section */
.flagged-section {
    margin-top: 16px;
    background: var(--warning-bg);
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}

.flagged-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--warning);
    margin-bottom: 8px;
}

.flagged-list {
    list-style: none;
    font-size: 13px;
    color: #92400e;
}

.flagged-list li {
    padding: 4px 0;
    font-family: 'SF Mono', SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}

/* === Footer === */
footer {
    padding: 20px 32px;
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    border-top: 1px solid var(--border);
}

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

/* === Processing overlay on drop zone === */
.drop-zone.processing {
    pointer-events: none;
    opacity: 0.5;
}

/* === Progress bar for upload === */
.upload-progress {
    width: 100%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 16px;
    overflow: hidden;
}

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

/* === Responsive === */
@media (max-width: 640px) {
    header { padding: 12px 16px; }
    main { padding: 24px 16px; }
    .drop-zone { padding: 32px 16px; }
    .results-table { font-size: 13px; }
    .results-table th, .results-table td { padding: 8px 10px; }
}
