:root {
    --wf-bg: #f4f5fb;
    --wf-surface: #ffffff;
    --wf-primary: #2563eb;
    --wf-primary-soft: #e0edff;
    --wf-success: #16a34a;
    --wf-danger: #ef4444;
    --wf-border: #e2e8f0;
    --wf-text-main: #0f172a;
    --wf-text-muted: #6b7280;

    --wf-accent: #0ea5e9;
    --wf-warning: #f97316;

    /* compat مع الأسماء القديمة في مشروعك */
    --wf-card-bg: var(--wf-surface);
    --wf-text: var(--wf-text-main);

    --wf-radius-lg: 1rem;
    --wf-radius-md: 0.75rem;
    --wf-radius-pill: 999px;

    --wf-shadow-soft-sm: 0 6px 18px rgba(15, 23, 42, 0.08);
    --wf-shadow-soft-lg: 0 18px 45px rgba(15, 23, 42, 0.14);
}

/* ==== مهم عشان الـ footer يضل تحت ==== */
html,
body {
    height: 100%;
}

.theme-dark {
    --wf-bg: #020617;
    --wf-surface: #020617;
    --wf-primary: #38bdf8;
    --wf-primary-soft: rgba(56,189,248,0.18);
    --wf-success: #22c55e;
    --wf-danger: #f97373;
    --wf-border: #1f2937;
    --wf-text-main: #e5e7eb;
    --wf-text-muted: #9ca3af;

    --wf-card-bg: var(--wf-surface);
    --wf-text: var(--wf-text-main);
}

/* body كـ flex ليثبّت الـ footer تحت */
body.wf-body {
    min-height: 100vh;
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: 'Tajawal', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--wf-bg);
    /* موجات خفيفة في الخلفية */
    background-image:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 55%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.06), transparent 45%);
    background-attachment: fixed;
    color: var(--wf-text-main);
}

.wf-page {
    max-width: 1200px;
    margin-inline: auto;
}

/* ======================= NAVBAR / HEADER ======================= */

.wf-navbar {
    background: radial-gradient(circle at top right, #1e293b, #020617);
    background-color: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.5);
}

.wf-navbar .navbar-brand {
    font-weight: 700;
    letter-spacing: 0.02em;
}

.wf-logo-pill {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 20%, #38bdf8, #2563eb);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: #f9fafb;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.45);
}

.wf-brand-main {
    line-height: 1.2;
}

.wf-brand-main span:first-child {
    font-size: 1rem;
}

.wf-brand-main small {
    font-size: 0.7rem;
    color: rgba(226, 232, 240, 0.85) !important;
}

/* Nav links – حجم ثابت، بدون تكبير للـ active */
.wf-navbar .nav-link {
    font-size: 0.85rem;
    padding-inline: 0.85rem;
    padding-block: 0.4rem;
    border-radius: 999px;
    color: rgba(226, 232, 240, 0.85);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* أيقونة داخل اللينك */
.wf-navbar .nav-link i {
    font-size: 0.9rem;
    line-height: 1;
}

/* hover – نفس الحجم، فقط لون خلفية أفتح */
.wf-navbar .nav-link:hover {
    background-color: rgba(148, 163, 184, 0.25);
    color: #f9fafb;
}

/* active – نفس الـ hover تقريباً */
.wf-navbar .nav-link.active {
    background-color: rgba(148, 163, 184, 0.25);
    color: #f9fafb;
    box-shadow: none;
    font-weight: 500; /* تقدر تشيلها لو بدك كلهم نفس السماكة */
}

.wf-navbar .btn-outline-light {
    border-radius: 999px;
    padding-inline: 0.9rem;
    padding-block: 0.25rem;
    font-size: 0.8rem;
}

.wf-user-pill {
    border-radius: var(--wf-radius-pill);
    padding: 0.15rem 0.75rem;
    background-color: rgba(15, 23, 42, 0.22);
    color: #e5e7eb;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* main يتمدّد وياخد المساحة عشان الـ footer ينزل تحت */
.wf-main {
    padding-top: 5rem;     /* عشان الـ navbar ثابت */
    padding-bottom: 2.5rem;
    flex: 1 0 auto;
}

/* ======================= PAGE HEADER ======================= */

.wf-page-header {
    background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.06), transparent 55%),
                radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.08), transparent 55%),
                var(--wf-surface);
    border-radius: var(--wf-radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 1rem 1.25rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.wf-breadcrumb {
    font-size: 0.8rem;
    color: var(--wf-text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.wf-breadcrumb a {
    color: var(--wf-primary);
    text-decoration: none;
}

.wf-breadcrumb a:hover {
    text-decoration: underline;
}

.wf-page-title {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--wf-text-main);
}

.wf-page-subtitle {
    font-size: 0.85rem;
    color: var(--wf-text-muted);
}

.wf-page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
}

.wf-link-muted {
    color: var(--wf-text-muted);
    text-decoration: none;
}

.wf-link-muted:hover {
    color: var(--wf-text-main);
    text-decoration: underline;
}

/* ======================= CARDS & LAYOUT ======================= */

.wf-card {
    background-color: var(--wf-surface);
    border-radius: var(--wf-radius-lg);
    border: 1px solid var(--wf-border);
    box-shadow: var(--wf-shadow-soft-sm);
    padding: 1.25rem 1.5rem;
    transition: box-shadow 0.16s ease, border-color 0.16s ease;
}

/* hover بدون حركة، بس shadow ولون حافة */
.wf-card:hover {
    box-shadow: var(--wf-shadow-soft-lg);
    border-color: rgba(148, 163, 184, 0.85);
}

.wf-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.wf-card-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.wf-card-subtitle {
    font-size: 0.8rem;
    color: var(--wf-text-muted);
}

/* KPI Cards */
.wf-kpi-card {
    position: relative;
    overflow: hidden;
    padding: 1rem 1.1rem;
    border-radius: var(--wf-radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.98));
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    transition: box-shadow 0.16s ease, border-color 0.16s ease;
}

.wf-kpi-card::before {
    content: "";
    position: absolute;
    inset-inline-end: -30px;
    top: -40px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle at 30% 30%, rgba(37, 99, 235, 0.3), transparent 65%);
    opacity: 0.6;
}

/* hover بسيط فقط */
.wf-kpi-card:hover {
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
    border-color: rgba(148, 163, 184, 0.8);
}

.wf-kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background-color: var(--wf-primary-soft);
    color: var(--wf-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.wf-kpi-label {
    font-size: 0.8rem;
    color: var(--wf-text-muted);
    margin-bottom: 0.1rem;
}

.wf-kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.wf-kpi-meta {
    font-size: 0.75rem;
    color: var(--wf-text-muted);
}

.wf-kpi-tag-positive,
.wf-kpi-tag-negative {
    display: inline-flex;
    align-items: center;
    border-radius: var(--wf-radius-pill);
    padding: 0.05rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 500;
}

.wf-kpi-tag-positive {
    background-color: #dcfce7;
    color: #166534;
}

.wf-kpi-tag-negative {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Tables */
.wf-table-wrapper {
    border-radius: var(--wf-radius-lg);
    border: 1px solid var(--wf-border);
    overflow: hidden;
    background-color: var(--wf-surface);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.wf-table {
    margin-bottom: 0;
    font-size: 0.85rem;
}

.wf-table thead {
    background-color: #f8fafc;
}

.wf-table thead th {
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--wf-text-muted);
    border-bottom-color: var(--wf-border);
}

.wf-table tbody tr {
    border-bottom: 1px solid var(--wf-border);
}

.wf-table tbody tr:last-child {
    border-bottom: none;
}

.wf-table tbody tr:hover {
    background-color: #f9fafb;
}

.wf-table th,
.wf-table td {
    padding: 0.55rem 0.85rem;
    vertical-align: middle;
}

.wf-amount-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* Badges / Status */
.wf-badge-debit,
.wf-badge-credit,
.wf-status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: var(--wf-radius-pill);
    padding: 0.1rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.wf-badge-debit {
    background-color: #fee2e2;
    color: #b91c1c;
}

.wf-badge-credit {
    background-color: #dcfce7;
    color: #166534;
}

.wf-status-pill-neutral {
    background-color: #e5e7eb;
    color: #374151;
}

.wf-status-pill-success {
    background-color: #dcfce7;
    color: #166534;
}

.wf-status-pill-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Timeline */
.wf-timeline {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
}

.wf-timeline::before {
    content: "";
    position: absolute;
    inset-inline-start: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, rgba(148, 163, 184, 0.6), transparent);
}

.wf-timeline-item {
    position: relative;
    padding-inline-start: 2.5rem;
    padding-bottom: 0.95rem;
}

.wf-timeline-item:last-child {
    padding-bottom: 0;
}

.wf-timeline-dot {
    position: absolute;
    inset-inline-start: 7px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid var(--wf-surface);
    background-color: var(--wf-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.wf-timeline-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.wf-timeline-meta {
    font-size: 0.75rem;
    color: var(--wf-text-muted);
    margin-bottom: 0.2rem;
}

.wf-timeline-amount {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Forms */
.form-control {
    border-radius: 0.65rem;
    border-color: var(--wf-border);
    font-size: 0.9rem;
}

.form-control:focus {
    border-color: var(--wf-primary);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
}

.wf-form-label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--wf-text-main);
}

.wf-field-error {
    font-size: 0.75rem;
    color: var(--wf-danger);
    margin-top: 0.2rem;
}

/* Buttons */
.btn.wf-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    color: #ffffff;
    border-radius: 999px;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
    font-size: 0.85rem;
}

.btn.wf-btn-primary:hover {
    filter: brightness(1.03);
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.35);
}

/* Login / Auth */
.wf-auth-wrap {
    min-height: calc(100vh - 4.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.wf-auth-card {
    max-width: 860px;
    width: 100%;
    background-color: var(--wf-surface);
    border-radius: 1.25rem;
    box-shadow: var(--wf-shadow-soft-lg);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.wf-auth-illustration {
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.9), rgba(56, 189, 248, 0.7));
    position: relative;
    color: #f9fafb;
}

.wf-auth-illustration::before {
    content: "";
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(circle at 20% 0, rgba(15, 23, 42, 0.25), transparent 55%),
        radial-gradient(circle at 80% 100%, rgba(15, 23, 42, 0.18), transparent 45%);
    opacity: 0.9;
}

.wf-auth-illustration-inner {
    position: relative;
    z-index: 1;
}

.wf-auth-title {
    font-weight: 800;
    font-size: 1.6rem;
}

.wf-auth-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

.wf-auth-bullets li {
    margin-bottom: 0.35rem;
}

.wf-auth-form {
    background-color: var(--wf-surface);
}

/* Footer */
.wf-footer {
    font-size: 0.8rem;
    color: var(--wf-text-muted);
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.04), transparent 55%), #f9fafb;
    flex-shrink: 0; /* مهم عشان ما يطلع لفوق */
}

/* ====== Page load animation ====== */
@keyframes wf-fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wf-animate-in {
    animation: wf-fade-up 0.55s ease-out;
}

.wf-animate-delay-1 { animation-delay: 0.06s; }
.wf-animate-delay-2 { animation-delay: 0.12s; }
.wf-animate-delay-3 { animation-delay: 0.18s; }
.wf-animate-delay-4 { animation-delay: 0.24s; }

/* ======================= RESPONSIVE ======================= */

@media (max-width: 767.98px) {
    .wf-card {
        padding: 1rem 1rem;
    }

    .wf-page-header {
        padding: 0.9rem 1rem;
    }
}
