:root {
    --primary: #0F766E;
    --primary-dark: #0D5C56;
    --primary-light: #14B8A6;
    --primary-50: #F0FDFA;
    --primary-100: #CCFBF1;
    --accent: #D97706;
    --accent-light: #FCD34D;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --text: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --red: #DC2626;
    --orange: #EA580C;
    --yellow: #CA8A04;
    --green: #16A34A;
    --sidebar-width: 260px;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -4px rgba(0,0,0,0.05);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: 100;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-brand h1 {
    font-size: 20px; font-weight: 600;
    color: var(--primary); letter-spacing: -0.02em;
}

.sidebar-brand .brand-ar {
    font-family: 'Noto Sans Arabic', sans-serif;
    font-size: 14px; color: var(--text-secondary); margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; border-radius: 8px;
    color: var(--text-secondary); cursor: pointer;
    font-size: 14px; font-weight: 400;
    transition: all 0.15s ease; margin-bottom: 2px;
}

.nav-item:hover { background: var(--primary-50); color: var(--primary); }
.nav-item.active { background: var(--primary-50); color: var(--primary); font-weight: 500; }
.nav-item i { font-size: 18px; width: 20px; text-align: center; }

.nav-section {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted);
    padding: 16px 16px 6px;
}

/* ── Main Content ── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh; padding: 32px 40px;
}

.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.page-header p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ── Cards ── */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}

.card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border-light);
    font-size: 14px; font-weight: 500;
    display: flex; align-items: center; justify-content: space-between;
}

.card-body { padding: 20px; }

/* ── Input Group ── */
.input-group { display: flex; gap: 12px; align-items: center; }

.input-group input {
    flex: 1; padding: 10px 16px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; font-family: inherit;
    outline: none; transition: border-color 0.15s;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border: none; border-radius: 8px;
    font-size: 14px; font-weight: 500; font-family: inherit;
    cursor: pointer; transition: all 0.15s ease; white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── Stats Grid ── */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}

.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 12px; font-weight: 500; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 6px;
}

.stat-card .stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.orange { color: var(--orange); }
.stat-value.primary { color: var(--primary); }

/* ── Issues Table ── */
.issues-table { width: 100%; border-collapse: collapse; }

.issues-table th {
    font-size: 12px; font-weight: 500; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted); text-align: left;
    padding: 10px 12px; border-bottom: 1px solid var(--border);
}

.issues-table td {
    padding: 10px 12px; font-size: 13px;
    border-bottom: 1px solid var(--border-light); vertical-align: top;
}

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

.severity-badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
}

.severity-critical { background: #FEE2E2; color: var(--red); }
.severity-high { background: #FFEDD5; color: var(--orange); }
.severity-medium { background: #FEF9C3; color: var(--yellow); }
.severity-low { background: #DCFCE7; color: var(--green); }
.severity-info { background: var(--primary-100); color: var(--primary); }

/* ── Translation List ── */
.translation-item {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 0; border-bottom: 1px solid var(--border-light);
}

.translation-item:last-child { border-bottom: none; }
.translation-source { flex: 1; font-size: 14px; color: var(--text); }
.translation-arrow { color: var(--primary); font-size: 16px; }

.translation-target {
    flex: 1; font-family: 'Noto Sans Arabic', sans-serif;
    font-size: 14px; color: var(--text); direction: rtl; text-align: right;
}

.translation-badge {
    font-size: 11px; padding: 2px 6px; border-radius: 4px;
    background: var(--primary-50); color: var(--primary);
}

/* ── Quick Translate ── */
.quick-translate {
    display: grid; grid-template-columns: 1fr auto 1fr;
    gap: 16px; align-items: start;
}

.quick-translate textarea {
    width: 100%; padding: 14px 16px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; font-family: inherit;
    resize: vertical; min-height: 100px; outline: none;
}

.quick-translate textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.quick-translate .ar-output {
    font-family: 'Noto Sans Arabic', sans-serif;
    direction: rtl; text-align: right; background: var(--primary-50);
}

.quick-arrow {
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; padding-top: 36px;
}

/* ── Sections ── */
.section { display: none; }
.section.active { display: block; }

/* ── Loading ── */
.spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(248, 250, 252, 0.8); z-index: 1000;
    align-items: center; justify-content: center;
    flex-direction: column; gap: 16px;
}

.loading-overlay.visible { display: flex; }
.loading-overlay .spinner { width: 32px; height: 32px; border-width: 3px; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; }

/* ── Before / After ── */
.before-after-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.ba-pane { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }

.ba-label {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; font-size: 13px; font-weight: 600;
}

.ba-label-before { background: #FEE2E2; color: var(--red); }
.ba-label-after { background: #DCFCE7; color: var(--green); }

.ba-frame { width: 100%; height: 320px; border: none; display: block; background: #fff; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 20px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .quick-translate { grid-template-columns: 1fr; }
    .before-after-grid { grid-template-columns: 1fr; }
}
