/* =====================================================================
   أنماط مخصّصة تكمّل Tailwind CSS
   منصة العبيداني — دعم RTL والطباعة
   ===================================================================== */

:root {
    --brand-600: #0d9488;
    --brand-700: #0f766e;
    --brand-800: #115e59;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', system-ui, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------------- شريط التمرير ---------------- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---------------- مكوّنات متكررة ---------------- */

.card {
    @apply rounded-xl border border-slate-200 bg-white shadow-sm;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: .5rem;
    padding: .5rem 1rem;
    font-size: .875rem;
    font-weight: 500;
    transition: all .15s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--brand-700);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-800);
}

.btn-secondary {
    background: #fff;
    color: #334155;
    border-color: #cbd5e1;
}

.btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
}

.btn-danger {
    background: #e11d48;
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #be123c;
}

.btn-success {
    background: #059669;
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #047857;
}

/* حقول النماذج */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    border-radius: .5rem;
    border: 1px solid #cbd5e1;
    padding: .55rem .75rem;
    font-size: .875rem;
    background-color: #fff;
    color: #0f172a;
    transition: border-color .15s, box-shadow .15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background-color: #f1f5f9;
    color: #64748b;
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
    border-color: #f43f5e;
}

.form-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .8125rem;
    font-weight: 600;
    color: #334155;
}

.form-error {
    margin-top: .3rem;
    font-size: .75rem;
    color: #e11d48;
}

.form-hint {
    margin-top: .3rem;
    font-size: .75rem;
    color: #64748b;
}

.required::after {
    content: ' *';
    color: #e11d48;
}

/* الجداول */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.data-table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    text-align: right;
    padding: .75rem 1rem;
    white-space: nowrap;
    border-bottom: 1px solid #e2e8f0;
    font-size: .8125rem;
}

.data-table tbody td {
    padding: .75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.num {
    font-variant-numeric: tabular-nums;
    direction: ltr;
    display: inline-block;
    unicode-bidi: embed;
}

/* التبويبات */
.tab-btn {
    padding: .6rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.tab-btn.active {
    color: var(--brand-700);
    border-bottom-color: var(--brand-700);
}

/* النوافذ المنبثقة */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 60;
}

.modal-panel {
    background: #fff;
    border-radius: 1rem;
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .3);
}

/* شريط التقدّم */
.progress {
    height: .5rem;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress > span {
    display: block;
    height: 100%;
    background: var(--brand-600);
    border-radius: 999px;
    transition: width .4s ease;
}

/* ---------------- أنماط الطباعة ---------------- */
@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 12pt;
    }

    .print\:hidden,
    header, footer, aside, nav,
    .no-print {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    main {
        padding: 0 !important;
    }

    .card,
    .print-sheet {
        border: 0 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .data-table thead th {
        background: #f1f1f1 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a[href]::after {
        content: '';
    }

    .page-break {
        page-break-before: always;
    }
}

.print-only {
    display: none;
}

/* ---------------- حركات ---------------- */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fade-in .2s ease-out;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

/* تمييز الحقول الرقمية داخل RTL */
input[type="number"],
input[type="tel"],
input[dir="ltr"] {
    direction: ltr;
    text-align: right;
}

/* بطاقة العضوية */
.member-card {
    width: 85.6mm;
    height: 54mm;
    border-radius: 12px;
    background: linear-gradient(135deg, #0f766e 0%, #115e59 60%, #0f172a 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.member-card::after {
    content: '';
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
    top: -60px;
    left: -40px;
}
