@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Tajawal', sans-serif;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: env(safe-area-inset-right, 0px);
    padding-left: env(safe-area-inset-left, 0px);
}

body > * {
    max-width: 100%;
}

/* Shared responsive safeguards for customer, employee and admin pages. */
main,
section,
article,
form,
.container,
.grid > *,
.flex > * {
    min-width: 0;
}

img,
video,
canvas,
svg {
    max-width: 100%;
}

img,
video {
    height: auto;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

button,
a,
label,
input[type="button"],
input[type="submit"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

:where(h1, h2, h3, h4, h5, h6, p, label, a, button) {
    overflow-wrap: break-word;
    word-break: normal;
    text-overflow: clip;
}

table {
    font-family: 'Tajawal', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
}

th,
td {
    overflow-wrap: normal;
    word-break: normal;
}

th {
    font-weight: 700;
    white-space: nowrap;
}

:where(.overflow-x-auto, [class*="overflow-x-auto"]) {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
}

@media (max-width: 767px) {
    main {
        max-width: 100%;
    }

    :where(.overflow-x-auto, [class*="overflow-x-auto"]) {
        width: 100%;
        max-width: 100%;
    }

    table {
        font-size: 0.8125rem;
        line-height: 1.55;
    }

    th,
    td {
        white-space: nowrap;
    }

    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        font-size: 16px;
    }

    [role="dialog"],
    dialog,
    :where([class*="fixed"][class*="inset-0"]) > div {
        max-width: calc(100vw - 1rem);
        max-height: calc(100dvh - 1rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
}

/* PWA Install Banner Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

#install-banner {
    animation: slideUp 0.5s ease-out, pulse 2s ease-in-out infinite;
}

/* RTL Support for Install Banner */
[dir="rtl"] #install-banner {
    direction: rtl;
}

/* Smooth transitions for all interactive elements */
button,
a {
    transition: all 0.3s ease;
}

/* Custom scrollbar for better aesthetics */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1F1F1F;
}

::-webkit-scrollbar-thumb {
    background: #4DA8DA;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3B8AB8;
}
