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

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --accent-emerald: #059669;
    --accent-emerald-hover: #047857;
    --accent-gold: #d97706;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-highlight: rgba(5, 150, 105, 0.3);
    --status-success: #10b981;
    --status-warning: #f59e0b;
    --status-danger: #ef4444;
    --font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    --transition-speed: 0.3s;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    direction: rtl; /* Set main direction to Arabic RTL */
    overflow-x: hidden;
    position: relative;
}

/* Background decorative blobs */
body::before, body::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(150px);
    z-index: -1;
    opacity: 0.06;
}

body::before {
    top: 10%;
    right: 5%;
    background-color: var(--accent-emerald);
}

body::after {
    bottom: 15%;
    left: 5%;
    background-color: #3b82f6;
}

/* App Header & Footer */
header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}

.logo-text {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--text-primary);
}

main {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
}

footer {
    padding: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.8);
}

/* Glassmorphism Verification Card */
.verification-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    transition: transform var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.verification-card:hover {
    border-color: var(--border-highlight);
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    text-align: center;
}

.card-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Status Messages */
.status-box {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid transparent;
    line-height: 1.5;
}

.status-box.info {
    background: rgba(59, 130, 246, 0.08);
    color: #1e3a8a;
    border-color: rgba(59, 130, 246, 0.15);
}

.status-box.warning {
    background: rgba(245, 158, 11, 0.08);
    color: #78350f;
    border-color: rgba(245, 158, 11, 0.15);
}

.status-box.error {
    background: rgba(239, 68, 68, 0.08);
    color: #7f1d1d;
    border-color: rgba(239, 68, 68, 0.15);
}

.status-box.success {
    background: rgba(16, 185, 129, 0.08);
    color: #064e3b;
    border-color: rgba(16, 185, 129, 0.15);
}

/* Form Styling */
.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    right: 1rem;
    color: var(--text-muted);
    transition: color var(--transition-speed);
}

.form-input {
    width: 100%;
    padding: 0.85rem 2.75rem 0.85rem 1rem; /* Right padding for RTL icon */
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1.1rem;
    letter-spacing: 0.2em; /* Good for digit codes */
    text-align: center;
    transition: all var(--transition-speed);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
    background-color: var(--bg-secondary);
}

.form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-tertiary);
}

/* Primary Button style */
.btn {
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, var(--accent-emerald), var(--accent-emerald-hover));
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-family: var(--font-family);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.3);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

/* Dashboard Styling */
.dashboard-container {
    width: 95%;
    max-width: 1200px;
    margin: 2rem auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.05);
}

.dashboard-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}

.dashboard-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: rgba(241, 245, 249, 0.4);
    border-bottom: 1px solid var(--border-color);
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.total { background: rgba(59, 130, 246, 0.1); color: #2563eb; }
.stat-icon.success { background: rgba(5, 150, 105, 0.1); color: #059669; }
.stat-icon.denied { background: rgba(220, 38, 38, 0.1); color: #dc2626; }
.stat-icon.pending { background: rgba(217, 119, 6, 0.1); color: #d97706; }

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    font-size: 0.9rem;
}

.logs-table th, .logs-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logs-table th {
    background-color: rgba(241, 245, 249, 0.8);
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.logs-table tr:hover {
    background-color: rgba(15, 23, 42, 0.01);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.granted { background: rgba(5, 150, 105, 0.1); color: #059669; }
.badge.denied { background: rgba(220, 38, 38, 0.1); color: #dc2626; }
.badge.pending { background: rgba(217, 119, 6, 0.1); color: #d97706; }
.badge.failed { background: rgba(220, 38, 38, 0.1); color: #dc2626; }
.badge.success { background: rgba(5, 150, 105, 0.1); color: #059669; }

.text-mono {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    color: var(--text-primary);
}

.text-small {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.refresh-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-speed);
}

.refresh-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-emerald);
}

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

.spin {
    animation: spin 1s linear infinite;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
