/* Adera Events Access Control Design System (Arabic RTL Version) */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
    --bg-dark: #0b0f19;
    --bg-card: #151c2c;
    --bg-card-hover: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-emerald: #10b981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.25);
    --accent-rose: #ef4444;
    --accent-rose-glow: rgba(239, 68, 68, 0.25);
    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.25);
    --accent-blue: #3b82f6;
    --border-color: rgba(255, 255, 255, 0.08);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-main: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
    --font-arabic: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font-arabic);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    direction: rtl;
    text-align: right;
}

/* Header */
.app-header {
    background: rgba(21, 28, 44, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 1.3rem;
}

.admin-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    transition: all 0.2s ease;
}

.admin-link:hover {
    background: rgba(59, 130, 246, 0.25);
}

/* Scanner Main Screen */
.scanner-container {
    flex: 1;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.scanner-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-main);
    text-align: center;
}

.scanner-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.scanner-header p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 20px;
}

/* Viewfinder */
#reader-wrapper {
    position: relative;
    width: 100%;
    max-width: 340px;
    margin: 0 auto 20px auto;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    aspect-ratio: 1 / 1;
}

#reader {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}

#reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Custom Overlay Lines */
.scanner-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 28px;
    height: 28px;
    border: 3px solid var(--accent-blue);
}

.top-left { top: 20px; left: 20px; border-right: none; border-bottom: none; border-top-left-radius: 8px; }
.top-right { top: 20px; right: 20px; border-left: none; border-bottom: none; border-top-right-radius: 8px; }
.bottom-left { bottom: 20px; left: 20px; border-right: none; border-top: none; border-bottom-left-radius: 8px; }
.bottom-right { bottom: 20px; right: 20px; border-left: none; border-top: none; border-bottom-right-radius: 8px; }

.scan-line {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
    box-shadow: 0 0 12px var(--accent-blue);
    animation: scanMove 2.2s infinite ease-in-out;
}

@keyframes scanMove {
    0% { top: 20px; opacity: 0; }
    50% { opacity: 1; }
    100% { top: calc(100% - 20px); opacity: 0; }
}

/* Controls */
.scanner-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn {
    font-family: var(--font-arabic);
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
}

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

.btn-outline:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-block {
    width: 100%;
}

/* Modal Overlay */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.modal-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-main);
    text-align: right;
}

.form-group {
    margin: 16px 0;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-arabic);
    text-align: right;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Result Card Popup */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-main);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    left: 14px;
    background: rgba(0,0,0,0.3);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-header {
    padding: 18px 20px;
    text-align: center;
    background: #1e293b;
    border-bottom: 1px solid var(--border-color);
}

.result-badge {
    display: inline-block;
    padding: 8px 22px;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    border-radius: 50px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

/* Status variants */
.state-active .result-header { background: rgba(16, 185, 129, 0.15); }
.state-active .result-badge { background: var(--accent-emerald); color: #000; }

.state-inactive .result-header { background: rgba(239, 68, 68, 0.15); }
.state-inactive .result-badge { background: var(--accent-rose); color: #fff; }

.state-expired .result-header { background: rgba(245, 158, 11, 0.15); }
.state-expired .result-badge { background: var(--accent-amber); color: #000; }

.state-not_found .result-header { background: rgba(100, 116, 139, 0.15); }
.state-not_found .result-badge { background: var(--text-muted); color: #fff; }

.result-body {
    padding: 24px 20px;
    text-align: center;
}

.result-photo-container {
    width: 105px;
    height: 105px;
    margin: 0 auto 16px auto;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.result-photo-container img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.result-body h2 {
    font-size: 1.45rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.result-subtext {
    font-size: 0.98rem;
    color: var(--accent-blue);
    font-weight: 700;
}

.result-company-text {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.result-dates-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(0,0,0,0.25);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.date-col {
    display: flex;
    flex-direction: column;
}

.date-col .lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.date-col .val {
    font-size: 0.9rem;
    font-weight: 700;
}

.date-divider {
    color: var(--text-muted);
}

.result-msg-box {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.5;
    background: rgba(255,255,255,0.04);
    padding: 12px;
    border-radius: var(--radius-sm);
}

.result-footer {
    padding: 16px 20px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid var(--border-color);
}

.app-footer {
    text-align: center;
    padding: 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* Standalone verify.php visual card view */
body.verify-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.verify-container {
    width: 100%;
    max-width: 440px;
}

.brand-header {
    text-align: center;
    margin-bottom: 16px;
}

.brand-badge {
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-main);
}

.status-banner {
    padding: 24px 20px;
    text-align: center;
    color: #fff;
}

.status-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 6px;
}

.status-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.card-content {
    padding: 24px 20px;
    text-align: center;
}

.avatar-wrapper {
    width: 110px;
    height: 110px;
    margin: 0 auto 16px auto;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border-color);
}

.employee-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.employee-name {
    font-size: 1.55rem;
    font-weight: 800;
}

.employee-role {
    font-size: 1.05rem;
    color: var(--accent-blue);
    font-weight: 700;
    margin-top: 2px;
}

.employee-company {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: rgba(0,0,0,0.25);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.detail-value {
    font-size: 0.95rem;
    font-weight: 700;
}

.status-message {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.timestamp {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-footer {
    padding: 16px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid var(--border-color);
    text-align: center;
}
