/* ============================================================
   نظام إدارة المراجعين - Reviewer Management System
   Dark Industrial Arabic UI
   ============================================================ */

:root {
    --bg-primary: #080c15;
    --bg-secondary: #0e1525;
    --bg-card: #141c2e;
    --bg-card-hover: #1a2440;
    --bg-input: #0b1020;
    --border: #1c2844;
    --border-focus: #2563eb;
    --text-primary: #edf2f7;
    --text-secondary: #94a3b8;
    --text-muted: #5b6b82;
    --accent: #2563eb;
    --accent-hover: #1d4fd8;
    --accent-glow: rgba(37, 99, 235, 0.12);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.08);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.08);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.08);
    --info: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.08);
    --purple: #7c3aed;
    --purple-bg: rgba(124, 58, 237, 0.08);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 14px;
}

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

html { font-size: 16px; }

body {
    font-family: 'IBM Plex Sans Arabic', 'Noto Kufi Arabic', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Links ---- */
a { color: inherit; text-decoration: none; }

/* ============================================================
   Layout
   ============================================================ */
.app-wrapper {
    min-height: 100vh;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 15% 0%, rgba(37, 99, 235, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 100%, rgba(124, 58, 237, 0.03) 0%, transparent 50%);
}

.layout { display: flex; min-height: 100vh; }

.main-content {
    flex: 1;
    margin-right: 260px;
    padding: 32px;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0; top: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.sidebar-brand { display: flex; align-items: center; gap: 12px; }

.sidebar-brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.25);
}

.sidebar-brand h2 {
    font-family: 'Noto Kufi Arabic', sans-serif;
    font-size: 14px; font-weight: 700; color: var(--text-primary);
    line-height: 1.4;
}
.sidebar-brand span { font-size: 11px; color: var(--text-muted); display: block; }

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

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px; border-radius: var(--radius-sm);
    color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
    margin-bottom: 2px; font-size: 14px; font-weight: 500;
    border: none; background: none; width: 100%;
    text-align: right; font-family: inherit;
    text-decoration: none;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }

.nav-badge {
    margin-right: auto;
    background: var(--accent); color: white;
    font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600;
}

.sidebar-footer {
    padding: 16px 12px 0;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
.sidebar-user { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.sidebar-user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info p {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-info span { font-size: 11px; color: var(--text-muted); }

.mobile-toggle {
    display: none;
    position: fixed; top: 16px; right: 16px; z-index: 200;
    width: 44px; height: 44px; border-radius: 10px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-primary); cursor: pointer;
    align-items: center; justify-content: center;
}

/* ============================================================
   Page Structure
   ============================================================ */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px; flex-wrap: wrap; gap: 16px;
}
.page-title {
    font-family: 'Noto Kufi Arabic', sans-serif;
    font-size: 24px; font-weight: 700; color: var(--text-primary);
}
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   Stats Grid
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 1px var(--accent-glow);
}
.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-card-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.stat-card-icon.blue { background: var(--accent-glow); color: var(--accent); }
.stat-card-icon.green { background: var(--success-bg); color: var(--success); }
.stat-card-icon.purple { background: var(--purple-bg); color: var(--purple); }
.stat-card-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-card-value {
    font-size: 28px; font-weight: 800; color: var(--text-primary);
    font-family: 'Noto Kufi Arabic', sans-serif; line-height: 1; margin-bottom: 4px;
}
.stat-card-label { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 20px; }
.form-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 500; color: var(--text-secondary);
    margin-bottom: 8px;
}
.form-input {
    width: 100%; padding: 11px 16px;
    background: var(--bg-input); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-family: inherit; font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s; direction: rtl;
}
.form-input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input.input-error { border-color: var(--danger); }
.form-textarea { resize: vertical; min-height: 100px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 6px; }

.password-wrapper { position: relative; }
.password-toggle {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px;
}

.checkbox-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-secondary); cursor: pointer;
}
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 22px; border: none; border-radius: var(--radius-sm);
    font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
    text-decoration: none;
}
.btn-primary {
    background: var(--accent); color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--bg-input); color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-icon { padding: 8px; min-width: 36px; min-height: 36px; }

.btn-login { margin-top: 8px; padding: 13px; font-size: 15px; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.table-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    flex-wrap: wrap; gap: 12px;
}
.table-header h3 { font-size: 16px; font-weight: 600; }

.search-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 14px; min-width: 250px;
}
.search-box input {
    border: none; background: transparent; color: var(--text-primary);
    font-family: inherit; font-size: 14px; width: 100%; outline: none; direction: rtl;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }

table { width: 100%; border-collapse: collapse; }
th {
    text-align: right; padding: 14px 24px;
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    background: var(--bg-input); border-bottom: 1px solid var(--border);
}
td {
    padding: 14px 24px; font-size: 14px; color: var(--text-secondary);
    border-bottom: 1px solid var(--border); vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-card-hover); }
.td-name { font-weight: 600; color: var(--text-primary); }

.barcode-tag {
    background: var(--bg-input); padding: 3px 10px; border-radius: 5px;
    font-size: 12px; font-family: monospace; color: var(--accent);
    border: 1px solid var(--border);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.card-title {
    font-size: 16px; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }
.badge-admin { background: var(--purple-bg); color: var(--purple); }
.badge-supervisor { background: var(--info-bg); color: var(--info); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================================================
   Reviewer Detail
   ============================================================ */
.reviewer-detail { animation: fadeUp 0.4s ease; }
.reviewer-profile {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 24px; margin-bottom: 28px;
}
.profile-info {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 28px;
}
.profile-field {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.profile-field:last-child { border-bottom: none; }
.profile-field-icon { color: var(--text-muted); flex-shrink: 0; }
.profile-field-label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.profile-field-value { font-size: 15px; font-weight: 600; color: var(--text-primary); }

.qr-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 28px;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; text-align: center;
}
.barcode-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ============================================================
   Timeline
   ============================================================ */
.timeline { position: relative; }
.timeline-item { display: flex; gap: 16px; padding: 14px 0; }
.timeline-dot {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.timeline-dot.note { background: var(--accent-glow); color: var(--accent); }
.timeline-dot.pdf, .timeline-dot.file { background: var(--warning-bg); color: var(--warning); }
.timeline-dot.image { background: var(--success-bg); color: var(--success); }
.timeline-content {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px;
}
.timeline-meta {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 8px; flex-wrap: wrap;
}
.timeline-type { font-size: 12px; font-weight: 600; color: var(--accent); }
.timeline-date {
    font-size: 11px; color: var(--text-muted);
    display: flex; align-items: center; gap: 4px;
}
.timeline-text { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

/* ============================================================
   Activity
   ============================================================ */
.activity-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 0; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); margin-top: 7px; flex-shrink: 0;
}
.activity-text { font-size: 14px; color: var(--text-secondary); }
.activity-text strong { color: var(--text-primary); font-weight: 600; }
.activity-time {
    font-size: 11px; color: var(--text-muted); margin-top: 4px;
    display: flex; align-items: center; gap: 4px;
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px); display: flex;
    align-items: center; justify-content: center;
    z-index: 1000; padding: 20px; animation: fadeIn 0.2s ease;
}
.modal {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); width: 100%; max-width: 500px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: fadeUp 0.3s ease;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 24px 28px 16px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 4px; border-radius: 6px; transition: all 0.15s;
}
.modal-close:hover { background: var(--bg-input); color: var(--text-primary); }
.modal-body { padding: 24px 28px; }
.modal-footer { padding: 16px 28px 24px; display: flex; gap: 12px; }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-radius: var(--radius-sm);
    font-size: 14px; margin-bottom: 20px; font-weight: 500;
}
.alert-success {
    background: var(--success-bg); color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}
.alert-error {
    background: var(--danger-bg); color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

/* ============================================================
   Login Page
   ============================================================ */
.public-wrapper {
    min-height: 100vh;
    background: var(--bg-primary);
}

.login-container {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    padding: 24px; position: relative; overflow: hidden;
}

.login-bg-pattern {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 25% 20%, rgba(37, 99, 235, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 80%, rgba(124, 58, 237, 0.04) 0%, transparent 50%);
}

.login-content {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center;
    width: 100%; max-width: 440px;
}

.login-card {
    width: 100%; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 44px 36px; box-shadow: var(--shadow-lg);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.logo-icon {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px; color: white;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.25);
}
.login-logo h1 {
    font-family: 'Noto Kufi Arabic', sans-serif;
    font-size: 22px; font-weight: 700; margin-bottom: 4px;
}
.login-logo p { font-size: 14px; color: var(--text-muted); }

.login-divider {
    display: flex; align-items: center; gap: 16px;
    margin: 24px 0; color: var(--text-muted); font-size: 13px;
}
.login-divider::before, .login-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

.btn-reviewer-link {
    width: 100%; padding: 14px; border-radius: var(--radius-sm);
    background: var(--bg-input); border: 1.5px dashed var(--border);
    color: var(--text-secondary); font-family: inherit;
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: all 0.2s; display: flex; align-items: center;
    justify-content: center; gap: 10px; text-decoration: none;
}
.btn-reviewer-link:hover {
    border-color: var(--accent); color: var(--accent);
    background: var(--accent-glow);
}

.demo-box {
    margin-top: 24px; padding: 14px 16px;
    background: var(--bg-input); border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.demo-title {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-muted); margin-bottom: 8px; font-weight: 500;
}
.demo-creds { display: flex; flex-direction: column; gap: 3px; }
.demo-creds span { font-size: 12px; color: var(--text-secondary); }
.demo-creds code {
    background: var(--bg-card); padding: 1px 6px; border-radius: 4px;
    font-size: 12px; color: var(--accent); font-family: monospace;
}

.security-badge {
    display: flex; align-items: center; gap: 6px;
    margin-top: 20px; font-size: 12px; color: var(--text-muted);
}

/* ============================================================
   Scan Page
   ============================================================ */
.scan-container {
    min-height: 100vh; padding: 40px 20px;
    display: flex; justify-content: center;
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse at 50% 0%, rgba(37, 99, 235, 0.05) 0%, transparent 50%);
}
.scan-content { width: 100%; max-width: 500px; }
.scan-header { text-align: center; margin-bottom: 28px; }
.scan-header h1 {
    font-family: 'Noto Kufi Arabic', sans-serif;
    font-size: 22px; font-weight: 700; margin-bottom: 4px;
}
.scan-header p { font-size: 14px; color: var(--text-muted); }
.scan-card { margin-bottom: 16px; }

.back-link {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    color: var(--accent); font-size: 14px; margin-top: 24px; font-weight: 500;
}
.back-link:hover { text-decoration: underline; }

/* ============================================================
   Empty State
   ============================================================ */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state p { font-size: 15px; margin-top: 12px; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.fade-up { animation: fadeUp 0.4s ease both; }

/* ============================================================
   Pagination (Laravel default override)
   ============================================================ */
nav[role="navigation"] {
    display: flex; justify-content: center; gap: 4px;
}
nav[role="navigation"] a,
nav[role="navigation"] span {
    padding: 6px 12px; border-radius: 6px; font-size: 13px;
    color: var(--text-secondary); text-decoration: none;
}
nav[role="navigation"] a:hover { background: var(--bg-card-hover); color: var(--text-primary); }
nav[role="navigation"] span[aria-current] {
    background: var(--accent); color: white; font-weight: 600;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .mobile-toggle { display: flex; }
    .main-content { margin-right: 0; padding: 20px; padding-top: 72px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .reviewer-profile { grid-template-columns: 1fr; }
    .page-title { font-size: 20px; }
    th, td { padding: 12px 16px; }
    .table-header { flex-direction: column; }
    .search-box { min-width: 100%; }
    .login-card { padding: 32px 24px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}
