﻿/**
 * Mahartist — مرکزی Toast + Confirm Modal
 */

.ma-notify-root {
    --ma-notify-brand: var(--brand-primary, #8b5a2b);
    font-family: Webparseh-Regular, sans-serif;
    position: relative;
    z-index: 10000070;
}

.ma-notify-stack {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000070;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: min(460px, calc(100vw - 2rem));
    pointer-events: none;
}

html[dir="rtl"] .ma-notify-stack {
    left: 50%;
    right: auto;
}

.ma-notify-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.05rem 1.15rem;
    border-radius: 16px;
    background: #fff;
    border: 1px solid color-mix(in srgb, var(--ma-notify-brand) 12%, #e8e8e8);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14);
    pointer-events: auto;
    animation: ma-notify-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

.ma-notify-toast.is-leaving {
    animation: ma-notify-out 0.22s ease forwards;
}

.ma-notify-toast__icon {
    flex-shrink: 0;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.28rem;
}

.ma-notify-toast__body {
    flex: 1;
    min-width: 0;
    padding-top: 0.1rem;
}

.ma-notify-toast__title {
    margin: 0 0 0.2rem;
    font-size: 1.3rem;
    font-weight: 800;
    color: #1f1a17;
    line-height: 1.4;
}

.ma-notify-toast__message {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.6;
    color: #444;
    word-break: break-word;
}

.ma-notify-toast__close {
    flex-shrink: 0;
    width: 1.9rem;
    height: 1.9rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #999;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.ma-notify-toast__close:hover {
    background: #f3f3f3;
    color: #333;
}

.ma-notify-toast--success .ma-notify-toast__icon {
    background: color-mix(in srgb, #22c55e 14%, #fff);
    color: #15803d;
}

.ma-notify-toast--error .ma-notify-toast__icon {
    background: color-mix(in srgb, #ef4444 12%, #fff);
    color: #b42318;
}

.ma-notify-toast--warning .ma-notify-toast__icon {
    background: color-mix(in srgb, #f59e0b 14%, #fff);
    color: #b45309;
}

.ma-notify-toast--info .ma-notify-toast__icon {
    background: color-mix(in srgb, var(--ma-notify-brand) 12%, #fff);
    color: var(--ma-notify-brand);
}

.ma-notify-toast__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.35;
    animation: ma-notify-progress linear forwards;
}

.ma-notify-toast {
    position: relative;
}

/* Confirm modal */
.ma-notify-modal {
    position: fixed;
    inset: 0;
    z-index: 10000060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 12, 10, 0.52);
    backdrop-filter: blur(4px);
    animation: ma-notify-fade-in 0.2s ease;
}

.ma-notify-modal.is-leaving {
    animation: ma-notify-fade-out 0.18s ease forwards;
}

.ma-notify-modal__dialog {
    width: min(420px, 100%);
    padding: 1.35rem 1.25rem 1.15rem;
    border-radius: 18px;
    background: #fff;
    border: 1px solid color-mix(in srgb, var(--ma-notify-brand) 10%, #ececec);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    animation: ma-notify-modal-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.ma-notify-modal.is-leaving .ma-notify-modal__dialog {
    animation: ma-notify-modal-out 0.2s ease forwards;
}

.ma-notify-modal__icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.85rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: color-mix(in srgb, #f59e0b 14%, #fff);
    color: #b45309;
}

.ma-notify-modal__title {
    margin: 0 0 0.45rem;
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
    color: #1f1a17;
}

.ma-notify-modal__message {
    margin: 0 0 1.15rem;
    font-size: 1.2rem;
    line-height: 1.65;
    text-align: center;
    color: #555;
}

.ma-notify-modal__list {
    list-style: none;
    margin: 0 0 1.15rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: color-mix(in srgb, #f59e0b 8%, #fff);
    border: 1px solid color-mix(in srgb, #f59e0b 22%, #ececec);
    text-align: start;
}

.ma-notify-modal__list li {
    position: relative;
    padding: 0.35rem 0 0.35rem 1.35rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: #7a4a08;
    line-height: 1.45;
}

html[dir="rtl"] .ma-notify-modal__list li {
    padding: 0.35rem 1.35rem 0.35rem 0;
}

.ma-notify-modal__list li::before {
    content: "✗";
    position: absolute;
    inset-inline-start: 0;
    top: 0.35rem;
    color: #b45309;
    font-weight: 800;
}

.ma-notify-modal__icon--warning {
    background: color-mix(in srgb, #f59e0b 14%, #fff);
    color: #b45309;
}

.ma-notify-modal__icon--danger {
    background: color-mix(in srgb, #ef4444 12%, #fff);
    color: #b42318;
}

.ma-notify-modal__actions {
    display: flex;
    gap: 0.65rem;
}

.ma-notify-modal__btn {
    flex: 1;
    min-height: 2.85rem;
    border: none;
    border-radius: 12px;
    font-family: Webparseh-Regular, sans-serif !important;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ma-notify-modal__btn:hover {
    transform: translateY(-1px);
}

.ma-notify-modal__btn--cancel {
    background: #f4f4f4;
    color: #444;
}

.ma-notify-modal__btn--confirm {
    background: linear-gradient(135deg, var(--ma-notify-brand) 0%, color-mix(in srgb, var(--ma-notify-brand) 78%, #3d1a05) 100%);
    color: #fff;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--ma-notify-brand) 28%, transparent);
}

.ma-notify-modal__btn--danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.28);
}

@keyframes ma-notify-in {
    from { opacity: 0; transform: translateY(-12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ma-notify-out {
    to { opacity: 0; transform: translateY(-8px) scale(0.96); }
}

@keyframes ma-notify-progress {
    from { width: 100%; }
    to { width: 0%; }
}

@keyframes ma-notify-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ma-notify-fade-out {
    to { opacity: 0; }
}

@keyframes ma-notify-modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ma-notify-modal-out {
    to { opacity: 0; transform: translateY(8px) scale(0.96); }
}

@media (max-width: 575px) {
    .ma-notify-modal__actions {
        flex-direction: column-reverse;
    }
}

/* Shipping checkout modal */
.ma-shipping-modal__dialog {
    position: relative;
    width: min(520px, 100%);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.ma-shipping-modal__close {
    position: absolute;
    top: 0.85rem;
    inset-inline-end: 0.85rem;
    width: 2.35rem;
    height: 2.35rem;
    border: none;
    border-radius: 10px;
    background: #f4f4f4;
    color: #666;
    font-size: 1.65rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
    z-index: 2;
}

.ma-shipping-modal__close:hover {
    background: #ebe3dc;
    color: #1f1a17;
}

.ma-shipping-modal__form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    text-align: start;
}

.ma-shipping-modal__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.ma-shipping-modal__field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ma-shipping-modal__field span {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f1a17;
}

.ma-shipping-modal__field em {
    color: #b42318;
    font-style: normal;
}

.ma-shipping-modal__field--full {
    grid-column: 1 / -1;
}

.ma-shipping-modal__field input,
.ma-shipping-modal__field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 0.9rem;
    border: 1.5px solid color-mix(in srgb, var(--ma-notify-brand) 16%, #ddd);
    border-radius: 12px;
    font-family: Webparseh-Regular, sans-serif !important;
    font-size: 1.2rem;
    line-height: 1.5;
    color: #1f1a17;
    background: #fff;
    resize: vertical;
}

.ma-shipping-modal__field input:focus,
.ma-shipping-modal__field textarea:focus {
    outline: none;
    border-color: var(--ma-notify-brand);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ma-notify-brand) 12%, transparent);
}

.ma-shipping-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 0.75rem;
}

.ma-shipping-modal__actions .ma-notify-modal__btn {
    flex: none;
    width: 100%;
}

.ma-shipping-modal__submit,
.ma-shipping-modal button.ma-shipping-modal__submit,
.ma-shipping-modal .ma-notify-modal__btn--confirm.ma-shipping-modal__submit {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 3.4rem !important;
    padding: 0.95rem 1.25rem !important;
    border: none !important;
    border-radius: 14px !important;
    background: #8b5a2b !important;
    background-image: linear-gradient(135deg, #8b5a2b 0%, #5c3a1a 100%) !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    font-size: 1.35rem !important;
    font-weight: 800 !important;
    line-height: 1.4 !important;
    box-shadow: 0 10px 26px rgba(139, 90, 43, 0.4) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.ma-shipping-modal__submit:hover,
.ma-shipping-modal button.ma-shipping-modal__submit:hover {
    background: #744a22 !important;
    background-image: linear-gradient(135deg, #9a6735 0%, #5c3a1a 100%) !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

.ma-shipping-modal__submit:disabled {
    opacity: 0.7 !important;
    cursor: wait !important;
}

.ma-shipping-modal .ma-notify-modal__btn--cancel {
    background: #f0eeec !important;
    color: #555 !important;
    -webkit-text-fill-color: #555 !important;
    min-height: 2.85rem !important;
    font-size: 1.2rem !important;
    box-shadow: none !important;
}

@media (max-width: 575px) {
    .ma-shipping-modal__grid {
        grid-template-columns: 1fr;
    }

    .ma-shipping-modal__actions {
        flex-direction: column;
    }

    .ma-shipping-modal__submit {
        order: -1;
        width: 100% !important;
    }
}
