/* ============================================================
   Global UI/UX Enhancements — applies to all admin screens
   Loaded after app.css and main.css so it can refine them.
   ============================================================ */

/* ---------- Arabic typography (Cairo) ---------- */
html[dir="rtl"],
html[dir="rtl"] body,
html[dir="rtl"] button,
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea {
    font-family: 'Cairo', 'Plus Jakarta Sans', 'Segoe UI', Tahoma, sans-serif !important;
    letter-spacing: 0 !important;
}

html[dir="rtl"] body {
    line-height: 1.7;
}

/* RTL: fix table header alignment (theme forces text-left) */
html[dir="rtl"] th,
html[dir="rtl"] .text-left {
    text-align: right !important;
}

html[dir="rtl"] .text-right {
    text-align: left !important;
}

/* ---------- Smoother global feel ---------- */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Custom scrollbars ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c3c9d4;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9aa2b1;
}

/* ---------- Cards / page containers ---------- */
main .container>div {
    animation: pageFadeIn .25s ease-out;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Tables ---------- */
table.table,
table.min-w-full {
    border-collapse: separate !important;
    border-spacing: 0;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04) !important;
    background: #ffffff !important;
}

table.table thead,
table.min-w-full thead {
    background: #f4f6f9 !important;
}

table.table thead th,
table.min-w-full thead th {
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    color: #4b5563 !important;
    padding: 12px 16px !important;
    border-bottom: 1px solid #e5e7eb !important;
    white-space: nowrap;
}

table.table tbody td,
table.min-w-full tbody td {
    padding: 10px 16px !important;
    border-bottom: 1px solid #f1f3f6 !important;
    vertical-align: middle;
    font-size: 14px;
    color: #1f2937;
}

table.table tbody tr,
table.min-w-full tbody tr {
    background: #fff;
    transition: background-color .15s ease;
}

table.table tbody tr:hover,
table.min-w-full tbody tr:hover {
    background: #f8fafc !important;
}

table.table tbody tr:last-child td,
table.min-w-full tbody tr:last-child td {
    border-bottom: none !important;
}

/* keep the inactive-row indication readable */
.inactive-item {
    background-color: #f7f7f8 !important;
    opacity: .65;
}

.inactive-item:hover {
    opacity: .9;
}

/* ---------- Buttons ---------- */
button,
a.rounded-lg,
[type="submit"] {
    transition: transform .12s ease, box-shadow .15s ease, background-color .15s ease, opacity .15s ease !important;
}

button:hover:not(:disabled),
[type="submit"]:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(16, 24, 40, .14);
}

button:active:not(:disabled),
[type="submit"]:active:not(:disabled) {
    transform: scale(.97);
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid rgba(59, 130, 246, .55);
    outline-offset: 1px;
}

/* row action buttons: subtle rounded look */
td .flex.items-center.gap-x-2 button,
td button.p-2 {
    border-radius: 10px !important;
}

/* ---------- Forms ---------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    border-radius: 10px !important;
    border-color: #d7dce3 !important;
    transition: border-color .15s ease, box-shadow .15s ease;
    min-height: 40px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #7c9dd9 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .15) !important;
}

label {
    font-weight: 600;
    color: #374151;
}

/* checkbox / radio a bit bigger for touch */
input[type="checkbox"],
input[type="radio"] {
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
}

/* choices.js dropdown polish */
.choices__inner {
    border-radius: 10px !important;
    border-color: #d7dce3 !important;
    min-height: 40px;
}

.choices__list--dropdown {
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .12) !important;
}

/* ---------- Modals ---------- */
.fixed.inset-0.z-30 {
    z-index: 40 !important;
}

.fixed.inset-0.z-30 [role="dialog"] {
    position: relative;
    z-index: 50 !important;
}

[role="dialog"] {
    border-radius: 16px !important;
    box-shadow: 0 20px 50px rgba(16, 24, 40, .25) !important;
    animation: modalPop .22s cubic-bezier(.21, 1.02, .73, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* modal backdrop: soft blur */
.fixed.inset-0 .bg-gray-500.opacity-75 {
    backdrop-filter: blur(2px);
    background-color: rgba(31, 41, 55, .55) !important;
}

/* modal footer buttons full radius */
[role="dialog"] .bg-gray-50 button {
    border-radius: 10px !important;
    font-weight: 600;
}

/* ---------- Sidebar ---------- */
aside {
    box-shadow: 2px 0 12px rgba(16, 24, 40, .12);
}

aside a,
aside button {
    transition: background-color .15s ease, padding .15s ease !important;
    border-radius: 8px;
}

aside ul li a:hover,
aside ul li button:hover {
    background: rgba(255, 255, 255, .12) !important;
}

/* Sidebar accordion: collapsed by default, open only when toggled */
aside .sidebar-submenu-panel {
    display: none !important;
}

aside .sidebar-group-open > .sidebar-submenu-panel {
    display: block !important;
}

aside .sidebar-group .sidebar-chevron-open {
    display: none;
}

aside .sidebar-group .sidebar-chevron-closed {
    display: inline-block;
}

aside .sidebar-group-open .sidebar-chevron-open {
    display: inline-block;
}

aside .sidebar-group-open .sidebar-chevron-closed {
    display: none;
}

/* ---------- Header ---------- */
header {
    backdrop-filter: blur(6px);
    box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}

/* ---------- Pagination ---------- */
nav[role="navigation"] button,
nav[role="navigation"] span,
nav[role="navigation"] a {
    border-radius: 8px !important;
}

/* ---------- Badges / status pills ---------- */
.rounded-xl,
.rounded-full {
    font-variant-numeric: tabular-nums;
}

/* ---------- SweetAlert polish ---------- */
.swal2-popup {
    border-radius: 16px !important;
    font-family: inherit !important;
}

.swal2-styled.swal2-confirm {
    border-radius: 10px !important;
}

.swal2-styled.swal2-cancel {
    border-radius: 10px !important;
}

/* ---------- Livewire top progress bar ---------- */
#lw-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, #3b82f6, #22d3ee);
    z-index: 9999;
    opacity: 0;
    transition: width .3s ease, opacity .3s ease;
    pointer-events: none;
}

#lw-progress.active {
    opacity: 1;
}

/* Never block the admin UI with a stuck full-page loading layer */
.lw-page-loading,
.loading-overlay {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Mobile sidebar backdrop must stay hidden until menu is opened */
.mobile-menu-backdrop {
    display: none !important;
    pointer-events: none !important;
}

main {
    position: relative;
    z-index: 1;
}

/* ---------- Images in tables ---------- */
td img {
    border-radius: 10px;
    object-fit: cover;
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
    table.table thead th,
    table.min-w-full thead th {
        padding: 10px 10px !important;
    }

    table.table tbody td,
    table.min-w-full tbody td {
        padding: 8px 10px !important;
    }

    .container.grid.px-6 {
        padding-left: .75rem !important;
        padding-right: .75rem !important;
    }
}
