/* هوية "لوحة التذاكر": بنفسجي داكن للشريط والنصوص، نعناعي للإجراءات، وأصفر للتنبيه.
   المصدر الوحيد للألوان، و Tailwind يقرأ منها في index.html. لتغيير الهوية عدّل هذه القيم فقط. */
:root {
    --primary-50: #f6f4fb;
    --primary-100: #ece7f5;
    --primary-200: #d9cfeb;
    --primary-300: #b9a8d6;
    --primary-400: #8f78b8;
    --primary-500: #6b5196;
    --primary-600: #553c7b;
    --primary-700: #432f63;
    --primary-800: #36254f;
    --primary-900: #2e1a47;

    --mint-100: #d5f3ec;
    --mint-500: #2bb59a;
    --mint-600: #22a088;
    --mint-800: #0e5a4b;
    --mint-900: #08332b;

    --sun-100: #fdefcf;
    --sun-500: #f7b32b;
    --sun-700: #a86d00;
    --sun-900: #5c3b00;

    --rose-100: #fbe3e7;
    --rose-500: #d6455d;
    --rose-800: #8a1f33;

    --line: #e2dcef;
    --ink: #2e1a47;
    --ink-muted: #6b5a85;
    --page-bg: #f6f4fb;

    /* لون التذكرة حسب حالتها */
    --status-new: #b9a8d6;
    --status-progress: var(--sun-500);
    --status-awaiting: var(--mint-500);
    --status-closed: var(--primary-700);
    --status-rejected: #9a90ab;

    --font-display: "El Messiri", "IBM Plex Sans Arabic", Tahoma, sans-serif;
}

html, body {
    direction: rtl;
}

body {
    color: var(--ink);
}

#app {
    min-height: 100vh;
}

/* FocusOnNavigate يضع التركيز على عنوان الصفحة لقارئ الشاشة، بدون إطار ظاهر */
h1:focus {
    outline: none;
}

.font-display {
    font-family: var(--font-display);
}

/* حقول الإدخال الموحّدة */
.input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.6rem;
    padding: 0.5rem 0.8rem;
    background: #fff;
    font-size: 0.9rem;
    color: var(--ink);
}

.input:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-400) 20%, transparent);
}

.input:disabled {
    background: var(--primary-50);
    color: var(--ink-muted);
}

.label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin-bottom: 0.3rem;
}

/* الأزرار: الإجراء الرئيسي نعناعي، والباقي بإطار خفيف */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn:focus-visible {
    outline: 2px solid var(--primary-400);
    outline-offset: 2px;
}

.btn-primary { background: var(--mint-500); color: var(--mint-900); }
.btn-primary:hover:not(:disabled) { background: var(--mint-600); }
.btn-success { background: var(--mint-500); color: var(--mint-900); }
.btn-success:hover:not(:disabled) { background: var(--mint-600); }
.btn-plum { background: var(--primary-900); color: #fff; }
.btn-plum:hover:not(:disabled) { background: var(--primary-700); }
.btn-danger { background: var(--rose-500); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--rose-800); }
.btn-light { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-light:hover:not(:disabled) { border-color: var(--primary-300); background: var(--primary-50); }

/* الجداول */
.table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.table th {
    color: var(--ink-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-align: right;
    padding: 0.65rem 0.8rem;
    border-bottom: 2px dashed var(--line);
    white-space: nowrap;
}

.table td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--primary-50);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--primary-50);
}

.num {
    text-align: left;
    direction: ltr;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--line);
}

/* التذكرة: شريط لون الحالة على اليمين، وخط مثقوب بثقبين جانبيين */
.ticket {
    position: relative;
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-right: 6px solid var(--stripe, var(--status-new));
    border-radius: 4px 12px 12px 4px;
    transition: transform 0.15s, box-shadow 0.15s;
}

a.ticket:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -12px color-mix(in srgb, var(--primary-900) 45%, transparent);
}

.ticket-cut {
    position: relative;
    border-top: 2px dashed var(--line);
}

.ticket-cut::before,
.ticket-cut::after {
    content: "";
    position: absolute;
    top: -8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--cut-bg, var(--page-bg));
    border: 1px solid var(--line);
}

.ticket-cut::before { right: -14px; }
.ticket-cut::after { left: -8px; }

.stripe-new { --stripe: var(--status-new); }
.stripe-progress { --stripe: var(--status-progress); }
.stripe-awaiting { --stripe: var(--status-awaiting); }
.stripe-closed { --stripe: var(--status-closed); }
.stripe-rejected { --stripe: var(--status-rejected); }

/* أعمدة اللوحة */
.board {
    display: grid;
    grid-template-columns: repeat(4, minmax(15rem, 1fr));
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.board-column {
    background: color-mix(in srgb, var(--primary-100) 55%, transparent);
    border-radius: 14px;
    padding: 0.75rem;
    min-width: 0;
}

/* شارة العدد على جرس التنبيه */
.bell-count {
    position: absolute;
    top: -0.4rem;
    left: -0.5rem;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 9999px;
    background: var(--sun-500);
    color: var(--sun-900);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.15rem;
    text-align: center;
}

/* السجل الزمني للشكوى */
.timeline {
    position: relative;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 0.5rem;
    bottom: 0.5rem;
    right: 0.95rem;
    border-right: 2px dashed var(--line);
}

.print-only {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    a.ticket, a.ticket:hover { transition: none; transform: none; }
}

@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    body {
        background: #fff !important;
    }

    .no-print, header {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    main {
        padding: 0 !important;
        background: #fff !important;
    }

    .card, .ticket {
        box-shadow: none !important;
    }

    .table th, .table td {
        border: 1px solid #cbd5e1 !important;
        padding: 4px 6px !important;
    }

    .overflow-x-auto, .board {
        overflow: visible !important;
    }
}

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

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

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--line);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--mint-500);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "جاري التحميل");
}
