/* =====================================================================
   AhadCode Unified UI Theme — GarageSystem
   نظام تصميم موحّد ومشترك بين جميع مشاريع AhadCode (GarageSystem, HrSystem, ...)
   لا تُنشئ كلاسات أو ألوان جديدة داخل الصفحات — استخدم ما هو هنا فقط.
   ===================================================================== */

:root {
    /* الهوية اللونية */
    --navy: #102A43;
    --navy-dark: #0B1E30;
    --royal: #2563EB;
    --royal-dark: #1D4ED8;
    --royal-light: #DBEAFE;
    --gold: #F59E0B;
    --gold-light: #FEF3C7;

    /* حالات دلالية */
    --ac-success: #16A34A;
    --ac-success-light: #DCFCE7;
    --ac-danger: #DC2626;
    --ac-danger-light: #FEE2E2;
    --ac-warning: #D97706;
    --ac-warning-light: #FEF3C7;
    --ac-info: #0891B2;
    --ac-info-light: #CFFAFE;
    --ac-neutral: #64748B;
    --ac-neutral-light: #F1F5F9;

    /* أساسيات البطاقات */
    --ac-border: #E2E8F0;
    --ac-radius: 14px;
    --ac-radius-sm: 8px;
    --ac-shadow: 0 1px 3px rgba(16, 42, 67, .08), 0 1px 2px rgba(16, 42, 67, .04);
    --ac-shadow-hover: 0 8px 24px rgba(16, 42, 67, .10);
}

/* =====================================================================
   رأس الصفحة — page-head
   ===================================================================== */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fff;
    border: 1px solid var(--ac-border);
    border-radius: var(--ac-radius);
    padding: 1.1rem 1.4rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--ac-shadow);
}

.page-head__title {
    display: flex;
    align-items: center;
    gap: .85rem;
}

.page-head__icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--ac-radius-sm);
    background: var(--royal-light);
    color: var(--royal-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.page-head h1,
.page-head h2,
.page-head h3,
.page-head h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--navy);
}

.page-head .page-head-sub,
.page-head .text-muted {
    font-size: .85rem;
    margin-top: .15rem;
}

.page-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

/* =====================================================================
   البطاقة الحاوية — data-card
   ===================================================================== */
.data-card {
    background: #fff;
    border: 1px solid var(--ac-border);
    border-radius: var(--ac-radius);
    box-shadow: var(--ac-shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.data-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .9rem 1.25rem;
    background: #F8FAFC;
    border-bottom: 1px solid var(--ac-border);
    font-weight: 700;
    color: var(--navy);
}

.data-card__body {
    padding: 1.25rem;
}

/* شريط البحث والفلاتر أعلى data-card */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem;
    background: #fff;
    border: 1px solid var(--ac-border);
    border-radius: var(--ac-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--ac-shadow);
}

/* =====================================================================
   الجداول
   ===================================================================== */
.data-card .table,
table.ac-table {
    margin-bottom: 0;
}

.data-card .table thead th,
table.ac-table thead th {
    background: var(--navy);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    white-space: nowrap;
    border: none;
    padding: .85rem 1rem;
}

.data-card .table tbody td,
table.ac-table tbody td {
    padding: .85rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--ac-border);
}

.data-card .table tbody tr:hover,
table.ac-table tbody tr:hover {
    background: #F8FAFC;
}

.data-card .table tbody tr:last-child td,
table.ac-table tbody tr:last-child td {
    border-bottom: none;
}

/* رؤوس أعمدة قابلة للفرز — sortable-th يُضاف تلقائياً عبر js/table-sort.js */
.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

    .sortable-th:hover {
        background: var(--navy-dark);
    }

    .sortable-th:focus-visible {
        outline: 2px solid var(--gold);
        outline-offset: -2px;
    }

    .sortable-th::after {
        content: '\2195';
        display: inline-block;
        margin-inline-start: 6px;
        opacity: .55;
        font-size: .85em;
    }

    .sortable-th.sort-asc::after {
        content: '\2191';
        opacity: 1;
        color: var(--gold);
    }

    .sortable-th.sort-desc::after {
        content: '\2193';
        opacity: 1;
        color: var(--gold);
    }

/* =====================================================================
   شارات الحالة — st-badge
   ===================================================================== */
.st-badge {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    padding: .35em .85em;
    border-radius: 50rem;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

.st-badge--success,
.st-badge--active,
.st-badge--approved,
.st-badge--paid,
.st-badge--completed { background: var(--ac-success-light); color: #166534; }

.st-badge--danger,
.st-badge--inactive,
.st-badge--rejected,
.st-badge--cancelled,
.st-badge--unpaid,
.st-badge--overdue { background: var(--ac-danger-light); color: #991B1B; }

.st-badge--warning,
.st-badge--pending,
.st-badge--processing { background: var(--ac-warning-light); color: #92400E; }

.st-badge--info,
.st-badge--sent { background: var(--ac-info-light); color: #155E75; }

.st-badge--neutral,
.st-badge--draft,
.st-badge--other { background: var(--ac-neutral-light); color: #475569; }

.st-badge--royal { background: var(--royal-light); color: var(--royal-dark); }

/* =====================================================================
   أزرار الإجراءات في الجداول — act-btn
   ===================================================================== */
.act-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    font-size: .85rem;
    margin: 0 2px;
    transition: all .2s ease;
}

    .act-btn:hover {
        transform: translateY(-1px);
    }

.act-btn--edit { background: var(--royal-light); color: var(--royal-dark); }
    .act-btn--edit:hover { background: var(--royal); color: #fff; }

.act-btn--delete { background: var(--ac-danger-light); color: var(--ac-danger); }
    .act-btn--delete:hover { background: var(--ac-danger); color: #fff; }

.act-btn--view { background: var(--ac-neutral-light); color: var(--ac-neutral); }
    .act-btn--view:hover { background: var(--ac-neutral); color: #fff; }

.act-btn--print { background: var(--gold-light); color: #92400E; }
    .act-btn--print:hover { background: var(--gold); color: #fff; }

.act-btn--success { background: var(--ac-success-light); color: var(--ac-success); }
    .act-btn--success:hover { background: var(--ac-success); color: #fff; }

/* =====================================================================
   أزرار الصفحة العامة
   ===================================================================== */
.btn-royal {
    background: var(--royal);
    border-color: var(--royal);
    color: #fff;
}
    .btn-royal:hover { background: var(--royal-dark); border-color: var(--royal-dark); color: #fff; }

/* =====================================================================
   بطاقات الإحصائيات (لوحات التحكم والتقارير)
   ===================================================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--ac-border);
    border-radius: var(--ac-radius);
    box-shadow: var(--ac-shadow);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .9rem;
}

.stat-card__icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: var(--ac-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--royal-light);
    color: var(--royal-dark);
}

.stat-card__value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.1;
}

.stat-card__label {
    font-size: .8rem;
    color: var(--ac-neutral);
    margin-top: .15rem;
}

.stat-card--success .stat-card__icon { background: var(--ac-success-light); color: #166534; }
.stat-card--danger .stat-card__icon { background: var(--ac-danger-light); color: #991B1B; }
.stat-card--warning .stat-card__icon { background: var(--ac-warning-light); color: #92400E; }
.stat-card--gold .stat-card__icon { background: var(--gold-light); color: #92400E; }

/* =====================================================================
   حالة فارغة — empty-state
   ===================================================================== */
.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--ac-neutral);
}

    .empty-state i {
        display: block;
        font-size: 3.2rem;
        color: var(--royal);
        opacity: .35;
        margin-bottom: 1rem;
    }

    .empty-state h4 {
        font-size: 1.15rem;
        font-weight: 700;
        color: var(--navy);
        margin-bottom: .4rem;
    }

    .empty-state p {
        font-size: .9rem;
        margin-bottom: 1.25rem;
    }

/* =====================================================================
   الاستجابة (Responsive)
   ===================================================================== */
@media (max-width: 768px) {
    .page-head,
    .filter-bar,
    .data-card__body {
        padding: .9rem;
    }

    .data-card .table thead th,
    .data-card .table tbody td {
        padding: .6rem .5rem;
        font-size: .82rem;
    }

    .act-btn {
        width: 30px;
        height: 30px;
        font-size: .75rem;
    }
}

/* =====================================================================
   الطباعة — إخفاء عناصر التحكم غير المطلوبة عند الطباعة
   ===================================================================== */
@media print {
    .page-head-actions,
    .filter-bar,
    .act-btn {
        display: none !important;
    }
}
