/* Base overlay state - hidden */
.modal-overlay,
.toast-container,
.alert:not(.alert--permanent) {
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease-in, visibility 200ms ease-in;
}

.modal-overlay.open,
.toast-container.open,
.alert.open {
    opacity: 1;
    visibility: visible;
}

/* Bottom-sheet modal - mobile default */
.modal-overlay {
    align-items: flex-end;
}

.modal-overlay--center {
    align-items: center;
}

.modal-container {
    transform: translateY(100%);
    transition: transform 300ms ease-out;
}

.modal-overlay.open .modal-container {
    transform: translateY(0);
}

/* Desktop modal override */
@media (min-width: 640px) {
    .modal-overlay {
        align-items: center;
        padding: 24px;
    }
    .modal-container {
        transform: translateY(20px);
    }
    .modal-overlay.open .modal-container {
        transform: translateY(0);
    }
}

/* Toast - desktop top-right */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    transform: translateX(100%);
    transition: transform 300ms ease-out, opacity 200ms ease-in;
    z-index: 1000;
    max-width: 400px;
    width: calc(100% - 32px);
}

.toast-container.open {
    transform: translateX(0);
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    margin-bottom: 10px;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 200ms ease-in, transform 200ms ease-out;
    pointer-events: none;
}

.toast.open {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.toast.closing {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 150ms ease-in, transform 150ms ease-in;
}

.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-info { border-left: 4px solid #3b82f6; }

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
}

.toast-success .toast-icon { color: #10b981; }
.toast-error .toast-icon { color: #ef4444; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info .toast-icon { color: #3b82f6; }

.toast-message {
    font-size: 14px;
    line-height: 1.4;
    color: #161616;
    flex: 1;
}

/* Toast - mobile top-center */
@media (max-width: 639px) {
    .toast-container {
        left: 16px;
        right: 16px;
        top: 12px;
        transform: translateY(-100%);
        max-width: none;
        width: auto;
    }
    .toast-container.open {
        transform: translateY(0);
    }
}

/* Action drawer */
.action-drawer {
    transform: translateY(100%);
    transition: transform 300ms ease-out;
}

.action-drawer.open {
    transform: translateY(0);
}

.action-drawer.closing {
    transform: translateY(100%);
    transition: transform 250ms ease-in;
}

/* Reject modal */
.reject-modal {
    transform: translateY(20px);
    transition: opacity 200ms ease-in, transform 250ms ease-out, visibility 200ms;
}

.reject-modal.open {
    transform: translateY(0);
}

.reject-modal.closing {
    transform: translateY(20px);
    transition: transform 200ms ease-in;
}

/* Mobile bottom bar */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid var(--brand-powder);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    transition: transform 0.3s ease;
}

.mobile-bottom-bar.hidden {
    transform: translateY(100%);
}

.mobile-bottom-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    color: var(--icon-secondary);
    text-decoration: none;
    font-size: 11px;
    border: none;
    background: none;
    flex: 1;
}

.mobile-bottom-item.active {
    color: var(--brand-royal);
}

.mobile-bottom-item .icon {
    width: 22px;
    height: 22px;
}

@media (min-width: 768px) {
    .mobile-bottom-bar {
        display: none !important;
    }
}

/* More sheet bottom modal */
.more-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 200;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.more-sheet.open {
    transform: translateY(0);
}

.more-sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 360px) {
    .more-sheet-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.more-sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--icon-primary);
    transition: background 0.2s;
}

.more-sheet-item:hover {
    background: var(--brand-ice);
}

.more-sheet-item .icon {
    width: 24px;
    height: 24px;
    color: var(--brand-royal);
}

.more-sheet-item span {
    font-size: 12px;
    text-align: center;
}

/* Payment loading states */
.payment-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: paymentSpin 0.8s linear infinite;
    margin-right: 0.4em;
    vertical-align: middle;
}

@keyframes paymentSpin {
    to { transform: rotate(360deg); }
}

.btn.btn-primary[data-loading] .payment-spinner {
    display: inline-block;
}

.btn.btn-primary[data-loading] .payment-btn-label {
    visibility: hidden;
    display: inline-block;
}

.payment-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease-in, visibility 200ms ease-in;
}

.payment-loading-overlay.open {
    opacity: 1;
    visibility: visible;
}

.payment-loading-content {
    background: #fff;
    border-radius: 12px;
    padding: 28px 36px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-width: 420px;
    width: calc(100% - 32px);
}

.payment-loading-content .payment-spinner {
    width: 2em;
    height: 2em;
    margin: 0 auto 12px;
    border-width: 3px;
}

.payment-loading-content h4 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.payment-loading-content p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.4;
}

.payment-processing-msg {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1d4ed8;
    font-size: 14px;
}

.payment-processing-msg.visible {
    display: flex;
}
