@import 'tailwindcss';
@plugin '@tailwindcss/forms';

@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';

@theme {
    --font-sans: 'Figtree', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
        'Segoe UI Symbol', 'Noto Color Emoji';
}

[x-cloak] {
    display: none !important;
}

/* QR create/show: flush mobile action bar to the physical screen bottom (mobile only) */
@media (max-width: 1023px) {
    .mobile-action-bar {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 50;
        display: flex;
        flex-direction: column;
        background-color: #fff;
    }

    .mobile-action-bar__toolbar {
        display: flex;
        height: 4rem;
        flex-shrink: 0;
        align-items: center;
        gap: 0.75rem;
        border-top: 1px solid rgb(226 232 240);
        background-color: #fff;
        padding-inline: 1rem;
    }

    .mobile-action-bar__inset-fill {
        flex-shrink: 0;
        width: 100%;
        background-color: #fff;
        height: env(safe-area-inset-bottom, 0px);
        min-height: max(env(safe-area-inset-bottom, 0px), 20px);
    }
}

/* Extra white bleed behind the bar for any remaining viewport gap on mobile */
.qr-mobile-bottom-bleed {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 48;
    pointer-events: none;
    background-color: #fff;
    height: calc(4rem + env(safe-area-inset-bottom, 0px) + 24px);
    min-height: calc(4rem + 24px);
}

html.qr-mobile-page {
    background-color: #fff;
}

html.qr-mobile-page body {
    background-color: #fff;
}

/* Payment QR landing: lock scroll and keep the amount sheet flush to the screen bottom */
@media (max-width: 767px) {
    html.mini-payment-page,
    html.mini-payment-page body {
        overflow: hidden;
        width: 100%;
        height: 100%;
    }

    html.mini-payment-page body {
        position: fixed;
        inset: 0;
    }

    .mini-payment-sheet {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 20;
    }

    .mini-payment-bottom-bleed {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 19;
        pointer-events: none;
        background-color: #fff;
        height: calc(12rem + env(safe-area-inset-bottom, 0px));
        min-height: 8rem;
    }
}

.mobile-stats-card {
    width: calc(66.666667% - 0.5rem);
}

@layer components {
    .btn-primary {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        border-radius: 9999px;
        background-image: linear-gradient(to right, rgb(79 70 229), rgb(124 58 237));
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        line-height: 1.25rem;
        font-weight: 600;
        color: #fff;
        box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
        transition: filter 0.15s ease;
    }

    .btn-primary:hover {
        filter: brightness(0.92);
    }

    .btn-primary:disabled {
        opacity: 0.6;
        pointer-events: none;
    }

    .btn-primary-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        line-height: 1rem;
    }

    .btn-primary-lg {
        padding: 0.625rem 1.25rem;
    }

    .btn-secondary {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        border-radius: 9999px;
        border: 1px solid rgb(226 232 240);
        background-color: #fff;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        line-height: 1.25rem;
        font-weight: 600;
        color: rgb(51 65 85);
        box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
        transition: background-color 0.15s ease, border-color 0.15s ease;
    }

    .btn-secondary:hover {
        background-color: rgb(248 250 252);
        border-color: rgb(203 213 225);
    }

    .btn-secondary:disabled {
        opacity: 0.6;
        pointer-events: none;
    }

    .btn-warning {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        border-radius: 9999px;
        border: 1px solid rgb(252 211 77);
        background-color: #fff;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        line-height: 1.25rem;
        font-weight: 600;
        color: rgb(180 83 9);
        box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
        transition: background-color 0.15s ease, border-color 0.15s ease;
    }

    .btn-warning:hover {
        background-color: rgb(255 251 235);
        border-color: rgb(245 158 11);
    }

    .btn-warning:disabled {
        opacity: 0.6;
        pointer-events: none;
    }

    .btn-danger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        border-radius: 9999px;
        border: 1px solid rgb(254 202 202);
        background-color: #fff;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        line-height: 1.25rem;
        font-weight: 600;
        color: rgb(185 28 28);
        box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
        transition: background-color 0.15s ease, border-color 0.15s ease;
    }

    .btn-danger:hover {
        background-color: rgb(254 242 242);
        border-color: rgb(252 165 165);
    }

    .btn-danger:disabled {
        opacity: 0.6;
        pointer-events: none;
    }

    .btn-danger-plain {
        padding: 0;
        border: none;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        font-weight: 500;
    }

    .btn-danger-plain:hover {
        background: transparent;
        text-decoration: underline;
    }

    .btn-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.375rem;
        border-radius: 9999px;
        border: 1px solid transparent;
        background-color: transparent;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        line-height: 1.25rem;
        font-weight: 600;
        color: rgb(67 56 202);
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .btn-link:hover {
        background-color: rgb(238 242 255);
        color: rgb(55 48 163);
    }

    .btn-link:disabled {
        opacity: 0.6;
        pointer-events: none;
    }

    .btn-link-plain {
        padding: 0;
        border: none;
        background: transparent;
        border-radius: 0;
        font-weight: 500;
    }

    .btn-link-plain:hover {
        background: transparent;
        text-decoration: underline;
    }

    .btn-sm {
        padding: 0.25rem 0.625rem;
        font-size: 0.75rem;
        line-height: 1rem;
    }

    .btn-group {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem;
    }

    .btn-group > form {
        display: inline-flex;
        margin: 0;
    }

    .btn-fab {
        display: inline-flex;
        height: 2.75rem;
        width: 2.75rem;
        align-items: center;
        justify-content: center;
        border-radius: 9999px;
        background-image: linear-gradient(to right, rgb(79 70 229), rgb(124 58 237));
        color: #fff;
        box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
        transition: filter 0.15s ease;
    }

    .btn-fab:hover {
        filter: brightness(0.92);
    }

    /* Consultation / specialty action FAB — sits above mobile bottom nav */
    .clinical-actions-fab {
        position: fixed;
        right: 1rem;
        bottom: calc(4rem + env(safe-area-inset-bottom, 0px) + 0.75rem);
        z-index: 45;
        display: inline-flex;
        height: 3.25rem;
        width: 3.25rem;
        align-items: center;
        justify-content: center;
        border-radius: 9999px;
        background-image: linear-gradient(to right, rgb(79 70 229), rgb(124 58 237));
        color: #fff;
        box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.15), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    }

    .clinical-actions-fab:hover {
        filter: brightness(0.95);
    }
}


@media (min-width: 640px) {
    .mobile-stats-card {
        width: auto;
    }
}

/* Ladill app launcher — cap at 5 rows (15 apps), always-visible scroll indicator */
.ladill-launcher-apps-wrap {
    position: relative;
}

.ladill-launcher-apps {
    max-height: calc(5 * 5.25rem + 4 * 0.25rem);
    overflow-y: scroll;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgb(148 163 184) rgb(241 245 249);
    margin-right: -0.25rem;
    padding-right: 0.25rem;
}

.ladill-launcher-apps::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 8px;
}

.ladill-launcher-apps::-webkit-scrollbar-track {
    background: rgb(241 245 249);
    border-radius: 9999px;
}

.ladill-launcher-apps::-webkit-scrollbar-thumb {
    background-color: rgb(148 163 184);
    border-radius: 9999px;
    min-height: 2.5rem;
    border: 2px solid rgb(241 245 249);
    background-clip: padding-box;
}

.ladill-launcher-apps::-webkit-scrollbar-thumb:hover {
    background-color: rgb(100 116 139);
}

.ladill-launcher-scroll-more {
    position: absolute;
    left: 50%;
    bottom: 0.125rem;
    z-index: 1;
    display: flex;
    height: 1.25rem;
    width: 1.25rem;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgb(255 255 255);
    color: rgb(100 116 139);
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
    pointer-events: none;
}
html:has(.qms-display),
html:has(.qms-display) body,
html:has(.qms-display) .qms-display,
html:has(.qms-display) .qms-display__unlock {
    font-family: 'Figtree', ui-sans-serif, system-ui, sans-serif;
}

html:has(.qms-display),
html:has(.qms-display) body {
    height: 100%;
    overflow: hidden;
}

.qms-display {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    font-family: inherit;
    background:
        radial-gradient(ellipse 90% 60% at 50% -20%, rgb(238 242 255 / 0.9), transparent),
        linear-gradient(180deg, rgb(248 250 252) 0%, rgb(255 255 255) 100%);
    color: rgb(15 23 42);
}

.qms-display__shell {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
}

.qms-display__header {
    flex-shrink: 0;
}

.qms-display__main {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    max-width: 120rem;
}

.qms-display__footer {
    flex-shrink: 0;
}

.qms-display__tickets {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: clamp(0.75rem, 1.5vw, 1.5rem);
    overflow: hidden;
}

.qms-display__tickets[data-ticket-count="1"] {
    grid-template-columns: minmax(0, 1fr);
}

.qms-display__tickets[data-ticket-count="2"],
.qms-display__tickets[data-ticket-count="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.qms-display__serving-heading {
    display: flex;
    flex-shrink: 0;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: clamp(0.65rem, 1.6vh, 1.25rem);
}

.qms-display__serving-heading h1 {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    color: rgb(15 23 42);
}

.qms-display__serving-heading > p {
    font-size: clamp(0.75rem, 1.2vw, 1rem);
    font-weight: 600;
    color: rgb(100 116 139);
}

.qms-display__grid-bg {
    background-image:
        linear-gradient(rgb(148 163 184 / 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgb(148 163 184 / 0.08) 1px, transparent 1px);
    background-size: 48px 48px;
}

.qms-display__ticket {
    container-type: size;
    display: flex;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgb(203 213 225);
    box-shadow: 0 16px 32px -20px rgb(15 23 42 / 0.2);
}

.qms-display__ticket-accent {
    height: 4px;
    flex-shrink: 0;
    background: linear-gradient(90deg, rgb(67 56 202), rgb(124 58 237), rgb(99 102 241));
}

.qms-display__ticket-body {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: clamp(0.35rem, 1vh, 0.75rem);
    padding: clamp(0.85rem, 2vh, 1.5rem) clamp(1rem, 2vw, 1.75rem);
}

.qms-display__ticket-meta {
    display: flex;
    flex-shrink: 0;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.qms-display__badge {
    flex-shrink: 0;
    border-radius: 9999px;
    padding: 0.35rem 0.7rem;
    font-size: clamp(0.62rem, 0.85vw, 0.78rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
    background: rgb(67 56 202);
    color: #fff;
}

.qms-display__queue-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    font-size: clamp(0.75rem, 1.1vw, 1rem);
    font-weight: 700;
    line-height: 1.15;
    color: rgb(51 65 85);
}

.qms-display__ticket-number {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    margin: 0;
    overflow: hidden;
    text-align: center;
    font-size: clamp(2.5rem, min(12cqh, 9cqw), 5.5rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.045em;
    line-height: 1;
    color: rgb(30 41 59);
}

.qms-display__destination {
    flex-shrink: 0;
    min-width: 0;
    border-top: 1px solid rgb(226 232 240);
    padding-top: clamp(0.55rem, 1.2vh, 0.9rem);
    text-align: center;
}

.qms-display__destination > span {
    display: block;
    margin-bottom: 0.25rem;
    font-size: clamp(0.65rem, 0.85vw, 0.8rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.2;
    text-transform: uppercase;
    color: rgb(100 116 139);
}

.qms-display__counter-name {
    margin: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: clamp(1.1rem, min(4.5cqh, 3.2cqw), 2rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: rgb(15 23 42);
}

.qms-display__tickets[data-ticket-count="1"] .qms-display__ticket-body {
    padding-inline: clamp(1.5rem, 6vw, 6rem);
}

.qms-display__tickets[data-ticket-count="1"] .qms-display__ticket-number {
    font-size: clamp(4rem, min(28cqh, 18cqw), 12rem);
}

.qms-display__tickets[data-ticket-count="1"] .qms-display__counter-name {
    font-size: clamp(1.5rem, min(7cqh, 5cqw), 3.5rem);
}

.qms-display__tickets[data-ticket-count="2"] .qms-display__ticket-number {
    font-size: clamp(3.25rem, min(18cqh, 12cqw), 8rem);
}

.qms-display__tickets[data-ticket-count="2"] .qms-display__counter-name {
    font-size: clamp(1.25rem, min(5.5cqh, 3.8cqw), 2.5rem);
}

@media (max-width: 767px) {
    html:has(.qms-display),
    html:has(.qms-display) body {
        height: auto;
        min-height: 100%;
        overflow: auto;
    }

    .qms-display {
        height: auto;
        min-height: 100dvh;
        max-height: none;
        overflow: visible;
    }

    .qms-display__tickets,
    .qms-display__tickets[data-ticket-count] {
        grid-template-columns: minmax(0, 1fr);
        grid-auto-rows: minmax(13rem, auto);
        overflow: visible;
    }

    .qms-display__ticket {
        container-type: inline-size;
        min-height: 13rem;
    }

    .qms-display__ticket-number,
    .qms-display__tickets[data-ticket-count="1"] .qms-display__ticket-number,
    .qms-display__tickets[data-ticket-count="2"] .qms-display__ticket-number {
        flex: 0 0 auto;
        padding-block: 0.75rem;
        font-size: clamp(3.25rem, 18vw, 5.5rem);
    }

    .qms-display__counter-name,
    .qms-display__tickets[data-ticket-count="1"] .qms-display__counter-name,
    .qms-display__tickets[data-ticket-count="2"] .qms-display__counter-name {
        font-size: clamp(1.15rem, 5vw, 1.75rem);
    }
}

@media (min-width: 768px) and (max-aspect-ratio: 4 / 3) {
    .qms-display__tickets[data-ticket-count="3"],
    .qms-display__tickets[data-ticket-count="5"],
    .qms-display__tickets[data-ticket-count="6"],
    .qms-display__tickets[data-ticket-count="7"],
    .qms-display__tickets[data-ticket-count="8"],
    .qms-display__tickets[data-ticket-count="9"],
    .qms-display__tickets[data-ticket-count="10"],
    .qms-display__tickets[data-ticket-count="11"],
    .qms-display__tickets[data-ticket-count="12"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-height: 620px) and (min-width: 768px) {
    .qms-display__header > div {
        padding-block: 0.55rem;
    }

    .qms-display__main {
        padding-block: 0.6rem;
    }

    .qms-display__footer {
        padding-block: 0.4rem;
    }

    .qms-display__ticket-body {
        padding-block: 0.55rem;
        gap: 0.35rem;
    }

    .qms-display__ticket-number {
        font-size: clamp(2.25rem, min(14cqh, 8cqw), 4rem);
    }

    .qms-display__counter-name {
        font-size: clamp(1rem, min(5cqh, 3cqw), 1.5rem);
    }
}

.qms-display__ticket--empty {
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(180deg, #fff 0%, rgb(248 250 252) 100%);
}

.qms-display__live-dot {
    animation: qms-display-pulse 2s ease-in-out infinite;
}

@keyframes qms-display-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.qms-display__unlock {
    background:
        radial-gradient(ellipse 60% 40% at 50% 0%, rgb(199 210 254 / 0.5), transparent),
        rgb(255 255 255 / 0.97);
}
