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

:root {
    --bg: #f8f9fa;
    --card: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #f59e0b;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header h1 { font-size: 20px; font-weight: 600; }
.header-nav { display: flex; gap: 8px; }
.header-nav button {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: all 0.15s;
}
.header-nav button:hover { background: var(--bg); }
.header-nav button.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Container */
.container {
    max-width: 800px;
    margin: 32px auto;
    padding: 0 24px;
}

/* Card */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

/* Login */
.login-container {
    max-width: 360px;
    margin: 120px auto;
    padding: 0 24px;
}
.login-container h2 { text-align: center; margin-bottom: 24px; }
.login-container input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    margin-bottom: 12px;
}
.login-container .error { color: var(--error); font-size: 14px; margin-bottom: 8px; }

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}
.upload-zone .formats {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-light);
}
.upload-zone .filename {
    margin-top: 8px;
    font-weight: 600;
    color: var(--primary);
}

/* Language grid */
.lang-section { margin-bottom: 20px; }
.lang-section label { font-weight: 500; margin-bottom: 8px; display: block; }
.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}
.lang-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}
.lang-grid label:hover { background: var(--bg); }
.lang-grid input[type="checkbox"] { cursor: pointer; }
.select-all {
    font-size: 13px;
    color: var(--primary);
    cursor: pointer;
    margin-top: 8px;
    display: inline-block;
}
.select-all:hover { text-decoration: underline; }

/* Source lang */
.source-lang { margin-bottom: 20px; }
.source-lang select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    margin-left: 8px;
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e5e7eb; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #b91c1c; }

/* Translate row */
.translate-row {
    display: flex;
    align-items: center;
    gap: 16px;
}
.working-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
}
.hourglass {
    display: inline-block;
    animation: hourglass-flip 1s ease-in-out infinite;
    font-size: 18px;
}
@keyframes hourglass-flip {
    0%   { transform: rotate(0deg); }
    50%  { transform: rotate(180deg); }
    100% { transform: rotate(360deg); }
}

/* File expiry */
.file-expiry {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}
.file-expiry.expiry-warning { color: var(--warning); }
.file-expiry.expiry-expired { color: var(--error); }

/* Progress */
.progress-section { margin-top: 24px; }
.progress-bar-container {
    background: #e5e7eb;
    border-radius: 999px;
    height: 8px;
    margin: 12px 0;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 0.3s;
}
.progress-langs { list-style: none; margin-top: 12px; }
.progress-langs li {
    padding: 6px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* History */
.history-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.history-filters select, .history-filters input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}
.job-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.job-item:hover { border-color: var(--primary); }
.job-detail-inline {
    border-left: 3px solid var(--primary);
    margin-bottom: 8px;
}
.job-item .job-header { display: flex; justify-content: space-between; align-items: center; }
.job-item .job-title { font-weight: 500; }
.job-item .job-meta { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.job-item .job-error { color: var(--error); font-size: 13px; margin-top: 4px; }

.status-badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 500;
}
.status-completed { background: #dcfce7; color: #166534; }
.status-partial { background: #fef9c3; color: #854d0e; }
.status-failed { background: #fee2e2; color: #991b1b; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-pending { background: #f3f4f6; color: #6b7280; }

/* Error detail */
.error-block {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    font-size: 13px;
}
.error-block pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin-top: 8px;
    font-size: 12px;
}

/* Settings */
.settings-section {
    margin-bottom: 24px;
}
.settings-section h3 {
    margin-bottom: 12px;
    font-size: 16px;
}
.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.form-row label {
    min-width: 150px;
    font-size: 14px;
    color: var(--text-light);
}
.form-row input, .form-row select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}
.form-row input[type="number"] { max-width: 100px; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

/* Source detected */
.source-detected {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #1e40af;
    margin-bottom: 12px;
}

/* Utils */
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-light { color: var(--text-light); }
