* {
    box-sizing: border-box;
}

html, body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f6fa;
}

h1, h2, h3, h4, h5 {
    font-weight: 700;
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 1rem;
    color: #1e3a5f;
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #dbe4f0;
    border-top-color: #1e3a5f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.8rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .reload {
    margin-inline-start: 0.5rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
}

.card-stat {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-right: 4px solid #1e3a5f;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.09);
}

.card-stat h6 {
    color: #6c757d;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.card-stat .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e3a5f;
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.badge-status {
    padding: 0.35rem 0.7rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.card .table {
    margin-bottom: 0;
}

.card .table thead th {
    background: #f8f9fb;
    font-weight: 700;
    font-size: 0.85rem;
    color: #4a5568;
    border-bottom: 2px solid #edf0f4;
    white-space: nowrap;
}

.card .table tbody tr {
    transition: background 0.12s ease;
}

.card .table tbody tr:hover {
    background: #f8fafc;
}

.btn {
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background-color: #1e3a5f;
    border-color: #1e3a5f;
}

.btn-primary:hover {
    background-color: #16283f;
    border-color: #16283f;
    box-shadow: 0 4px 12px rgba(30,58,95,0.25);
}

/* جدول قابل للتمرير أفقياً على الشاشات الصغيرة بدل تكسّر التصميم */
.table-responsive-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 700px) {
    .card table {
        min-width: 640px;
    }

    .page-title h3 {
        font-size: 1.25rem;
    }
}

.alert {
    border-radius: 10px;
    border: none;
}

/* تأثير دخول بسيط للتنبيهات */
.alert-animated {
    animation: slideDown 0.25s ease;
}

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

/* طباعة كشف الحساب */
@media print {
    .no-print {
        display: none !important;
    }

    .sidebar, .top-bar {
        display: none !important;
    }

    body {
        background: #fff;
    }
}

/* نافذة منبثقة بسيطة (بدون الحاجة لمكتبات خارجية) */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1200;
    animation: fadeIn 0.15s ease;
}

.modal-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    width: 92%;
    max-width: 420px;
    z-index: 1201;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    animation: popIn 0.18s ease;
}

@keyframes popIn {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-box-wide {
    max-width: 640px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
