/*
 * Intizar Mart — storefront popups (Phase 2B), used by assets/js/ui-dialog.js.
 *
 * z-index 10100: a modal must cover everything, including the search overlay
 * (10000) and the order-cancel modals on user_order_details.php (9999/10000).
 * The "below 998" rule in CLAUDE.md is for floating, non-modal widgets.
 */
/*
 * No overflow:hidden scroll lock: style.css gives <body> its own overflow, so
 * hiding <html>'s overflow turns <body> into the scroller and the sticky
 * header jumps away. ui-dialog.js blocks wheel/touch scrolling on the overlay
 * instead.
 */
.ui-dialog-overlay {
    overscroll-behavior: contain;
    touch-action: none;
    position: fixed;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(17, 17, 17, 0.55);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.ui-dialog-overlay.is-visible {
    opacity: 1;
}

.ui-dialog {
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    border-top: 4px solid var(--primary-color, #F36621);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    padding: 28px 24px 22px;
    text-align: center;
    font-family: inherit;
    color: #333;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.18s ease;
}

.ui-dialog-overlay.is-visible .ui-dialog {
    transform: none;
}

.ui-dialog__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    background: #fff5eb;
    color: var(--primary-color, #F36621);
}

.ui-dialog--error .ui-dialog__icon {
    background: #fdf2f2;
    color: #e74c3c;
}

.ui-dialog--success .ui-dialog__icon {
    background: #e8f8f5;
    color: #1abc9c;
}

/* Phase 2D: 'danger' — deletes that cannot be undone (admin panel). */
.ui-dialog--danger {
    border-top-color: #e74c3c;
}

.ui-dialog--danger .ui-dialog__icon {
    background: #fdf2f2;
    color: #e74c3c;
}

.ui-dialog--danger .ui-dialog__btn--primary {
    background: #e74c3c;
}

.ui-dialog--danger .ui-dialog__btn--primary:hover {
    background: #c0392b;
}

.ui-dialog--danger .ui-dialog__btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.35);
}

.ui-dialog__title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111;
}

.ui-dialog__message {
    margin: 0 0 22px;
    font-size: 1rem;
    line-height: 1.55;
    color: #555;
    white-space: pre-line;
    word-wrap: break-word;
}

.ui-dialog__actions {
    display: flex;
    gap: 12px;
}

.ui-dialog__btn {
    flex: 1;
    min-height: 46px;
    padding: 12px 18px;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.ui-dialog__btn--primary {
    background: var(--primary-color, #F36621);
    color: #fff;
    border: none;
}

.ui-dialog__btn--primary:hover {
    background: #e65100;
}

.ui-dialog__btn--secondary {
    background: #fff;
    color: #333;
    border: 1.5px solid #ddd;
}

.ui-dialog__btn--secondary:hover {
    border-color: var(--primary-color, #F36621);
    color: var(--primary-color, #F36621);
}

.ui-dialog__btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(243, 102, 33, 0.35);
}

@media (max-width: 480px) {
    .ui-dialog {
        padding: 24px 18px 18px;
    }

    .ui-dialog__actions {
        flex-direction: column-reverse;
    }
}

/*
 * uiToast (Phase 2D): small non-blocking corner messages. Non-modal, so it
 * stays below 998 (CLAUDE.md layering rule for floating widgets).
 */
.ui-toast-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 997;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    max-width: calc(100vw - 40px);
    pointer-events: none;
}

.ui-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 360px;
    padding: 12px 16px;
    background: #fff;
    color: #333;
    border-left: 4px solid var(--primary-color, #F36621);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    font-size: 0.95rem;
    line-height: 1.4;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    word-wrap: break-word;
}

.ui-toast.is-visible {
    opacity: 1;
    transform: none;
}

.ui-toast__icon {
    flex: 0 0 auto;
    font-size: 1.15rem;
    color: var(--primary-color, #F36621);
}

.ui-toast--success { border-left-color: #1abc9c; }
.ui-toast--success .ui-toast__icon { color: #1abc9c; }
.ui-toast--error { border-left-color: #e74c3c; }
.ui-toast--error .ui-toast__icon { color: #e74c3c; }

@media (max-width: 480px) {
    .ui-toast-stack {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
        align-items: stretch;
    }

    .ui-toast {
        max-width: none;
    }
}

/*
 * Minimum-order messages (Phase 2B). New rules only — no existing rule in
 * style.css is changed. The header bar's "· Minimum order Rs. MIN" tail is
 * shown only on wide screens.
 */
.min-order-extra {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .min-order-extra {
        display: none;
    }
}
