/* Paddle Point final mobile/UI polish.
   Conservative overrides loaded last so existing desktop layouts keep their
   current design while compact screens get safer spacing and touch behavior. */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Standalone confirmation inherits auth.css body layout. Keep it document-like. */
.confirmation-page {
    display: block;
    place-items: initial;
    padding: 0;
    min-height: 100dvh;
}

/* Compact headers and controls should remain easy to tap. */
.profile-nav-btn,
.notification-button {
    flex: 0 0 auto;
}

@media (max-width: 760px) {
    input,
    select,
    textarea {
        /* Prevent automatic page zoom in mobile Safari when a field receives focus. */
        font-size: 16px;
    }

    .dashboard-actions,
    .account-actions {
        gap: 8px;
    }

    .profile-nav-btn,
    .notification-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    /* Booking: prioritize readable times over squeezing many columns together. */
    .booking-workspace,
    .booking-controls-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .booking-side-panel,
    .booking-panel {
        min-width: 0;
    }

    .time-slot-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .time-slot-btn {
        min-width: 0;
        min-height: 56px;
        padding-inline: 10px;
    }

    .booking-slot-legend {
        gap: 8px 12px;
    }

    /* Account transactions: keep reference/status and actions from colliding. */
    .payment-history-row {
        flex-wrap: wrap;
        gap: 12px;
    }

    .payment-history-main {
        flex: 1 1 100%;
    }

    .payment-history-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .payment-history-actions > a,
    .payment-history-actions > button {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    /* Operations review cards are frequently used on phones at the front desk. */
    .admin-payment-review-head,
    .admin-payment-review-body {
        gap: 10px;
    }

    .admin-payment-review-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    .admin-payment-review-actions .admin-payment-receipt-btn {
        grid-column: 1 / -1;
    }

    .admin-payment-review-actions button {
        width: 100%;
        min-height: 44px;
    }

    .admin-search-field input,
    .admin-filter-field select,
    .admin-date-field input {
        width: 100%;
    }

    /* A backdrop-filter on a sticky ancestor can become the containing block for
       fixed descendants on mobile browsers. Disable the blur on compact screens
       so the notification panel is bounded by the actual viewport. */
    .app-header {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    /* The panel is portaled to <body> on mobile so header/nav overflow cannot crop
       it. Keep it as a compact card under the bell rather than a full-screen sheet. */
    .notification-panel,
    .notification-panel.notification-panel-portal {
        position: fixed;
        z-index: 5000;
        top: max(78px, calc(68px + env(safe-area-inset-top)));
        right: max(12px, env(safe-area-inset-right));
        bottom: auto;
        left: auto;
        width: min(360px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        max-height: min(520px, calc(100dvh - 96px));
    }

    .notification-panel:not([hidden]) {
        display: flex;
        flex-direction: column;
    }

    .notification-list {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .notification-panel-head {
        flex: 0 0 auto;
        gap: 10px;
        padding: 15px 14px 12px;
    }

    .notification-item {
        padding: 13px 14px;
    }

    /* Confirmation page: preserve the receipt hierarchy at phone width. */
    .confirmation-shell {
        width: calc(100% - 20px);
        padding: 14px 0 30px;
    }

    .confirmation-topbar {
        margin-bottom: 10px;
    }

    .confirmation-back {
        min-height: 44px;
    }

    .confirmation-hero {
        padding: 20px 18px;
        gap: 12px;
    }

    .confirmation-logo {
        width: 54px;
        height: 54px;
        border-radius: 15px;
    }

    .confirmation-logo img {
        width: 48px;
        height: 48px;
    }

    .confirmation-title h1 {
        font-size: clamp(22px, 7vw, 30px);
        letter-spacing: -.7px;
    }

    .confirmation-meta-item,
    .confirmation-body {
        padding-left: 18px;
        padding-right: 18px;
    }

    .confirmation-summary-row {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 5px 12px;
    }

    .confirmation-summary-row strong {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .confirmation-card-actions {
        margin-left: 18px;
        margin-right: 18px;
    }
}

@media (max-width: 520px) {
    .confirmation-card {
        border-radius: 18px;
    }

    .confirmation-meta {
        grid-template-columns: minmax(0, 1fr);
    }

    .confirmation-meta-item,
    .confirmation-meta-item:nth-child(2),
    .confirmation-meta-item:nth-child(-n+2) {
        border-right: 0;
        border-bottom: 1px solid var(--line, #ded9cc);
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .confirmation-meta-item:last-child {
        border-bottom: 0;
    }

    .confirmation-body {
        gap: 18px;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .confirmation-booking-row {
        padding: 13px 14px;
    }

    .confirmation-note {
        margin-left: 18px;
        margin-right: 18px;
    }

    .admin-payment-review-head,
    .admin-payment-review-body {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-payment-review-amount {
        align-self: flex-start;
    }

    .payment-history-actions {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 380px) {
    .time-slot-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .confirmation-actions,
    .admin-payment-review-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-payment-review-actions .admin-payment-receipt-btn {
        grid-column: auto;
    }

    .notification-panel-head {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Landscape phones and short embedded browsers need vertical room more than width. */
@media (max-height: 540px) and (max-width: 760px) {
    .notification-panel,
    .notification-panel.notification-panel-portal {
        top: max(8px, env(safe-area-inset-top));
        right: max(8px, env(safe-area-inset-right));
        bottom: auto;
        max-height: calc(100dvh - 16px);
    }
}
