/* Native Arabic & System Font Stack - No External Fonts Required */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #475569;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", "Cairo", Tahoma, Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    display: flex;
}

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

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.brand-text h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.brand-text p {
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.sidebar-menu li {
    margin-bottom: 6px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s;
}

.sidebar-menu a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-menu a.active {
    background: var(--primary);
    color: white;
}

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

.user-info h4 {
    font-size: 13px;
    color: var(--text-main);
}

.user-info p {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

/* Main Area */
.main-wrapper {
    margin-right: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-navbar {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.page-title h1 {
    font-size: 20px;
    font-weight: 700;
}

.content-container {
    padding: 32px;
    flex: 1;
}

/* Dashboard Grid & Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }

.stat-details h3 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.stat-details p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Card Container */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.panel-header h2 {
    font-size: 17px;
    font-weight: 700;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    background: var(--bg-main);
    color: var(--text-muted);
    font-weight: 700;
    text-align: right;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tr:hover {
    background: #fbfcfe;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
}

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

.btn-secondary { background: var(--bg-main); color: var(--secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }

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

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-main);
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-dialog {
    background: white;
    width: 90%;
    max-width: 520px;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    transform: translateY(-20px);
    transition: transform 0.2s ease-in-out;
}

.modal-overlay.active .modal-dialog {
    transform: translateY(0);
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
}

/* Fullscreen Dynamic QR Display Screen */
.qr-screen-body {
    background: #090d16;
    color: #ffffff;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.qr-top-bar {
    padding: 18px 32px;
    background: #111827;
    border-bottom: 1px solid #1f2937;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qr-screen-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    padding: 24px 32px;
    overflow: hidden;
}

.qr-center-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #111827;
    border-radius: 20px;
    border: 1px solid #1f2937;
    padding: 30px;
}

.qr-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: inline-block;
    transition: transform 0.2s;
}

.qr-timer-bar {
    width: 320px;
    height: 8px;
    background: #374151;
    border-radius: 4px;
    margin-top: 24px;
    overflow: hidden;
}

.qr-timer-progress {
    height: 100%;
    background: #10b981;
    width: 100%;
    transition: width 0.1s linear;
}

.live-feed-sidebar {
    background: #111827;
    border-radius: 20px;
    border: 1px solid #1f2937;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.live-feed-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 14px;
}

.live-feed-item {
    background: #1f2937;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    .sidebar { display: none; }
    .main-wrapper { margin-right: 0; }
    .qr-screen-content { grid-template-columns: 1fr; }
}
