/**
 * Zyppts Pop-up Modules Styles
 * Custom toast notifications and confirmation modals
 */

/* Toast Container */
.zyppts-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

/* Toast Notification */
.zyppts-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 320px;
    max-width: 450px;
    padding: 16px;
    background: var(--bg-primary, #ffffff);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    border-left: 4px solid;
}

.zyppts-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.zyppts-toast-error {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.zyppts-toast-success {
    border-left-color: #28a745;
    background: #f0fff4;
}

.zyppts-toast-warning {
    border-left-color: #ffc107;
    background: #fffef0;
}

.zyppts-toast-info {
    border-left-color: #17a2b8;
    background: #f0f9ff;
}

.zyppts-toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.zyppts-toast-error .zyppts-toast-icon {
    color: #dc3545;
}

.zyppts-toast-success .zyppts-toast-icon {
    color: #28a745;
}

.zyppts-toast-warning .zyppts-toast-icon {
    color: #ffc107;
}

.zyppts-toast-info .zyppts-toast-icon {
    color: #17a2b8;
}

.zyppts-toast-content {
    flex: 1;
    min-width: 0;
}

.zyppts-toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-primary, #212529);
}

.zyppts-toast-message {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary, #6c757d);
}

.zyppts-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-secondary, #6c757d);
    opacity: 0.6;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.zyppts-toast-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

/* Modal Overlay */
.zyppts-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    pointer-events: none;
}

.zyppts-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    padding: 20px;
}

.zyppts-modal-overlay.show {
    opacity: 1;
}

.zyppts-modal {
    background: var(--bg-primary, #ffffff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.zyppts-modal-overlay.show .zyppts-modal {
    transform: scale(1);
}

.zyppts-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.zyppts-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #212529);
    display: flex;
    align-items: center;
}

.zyppts-modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.zyppts-modal-body p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary, #6c757d);
}

.zyppts-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color, #e9ecef);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.zyppts-modal-footer .btn {
    min-width: 100px;
    padding: 10px 20px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

.zyppts-modal-footer .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .zyppts-toast {
        background: var(--bg-primary, #1a1a1a);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .zyppts-toast-error {
        background: rgba(220, 53, 69, 0.1);
    }

    .zyppts-toast-success {
        background: rgba(40, 167, 69, 0.1);
    }

    .zyppts-toast-warning {
        background: rgba(255, 193, 7, 0.1);
    }

    .zyppts-toast-info {
        background: rgba(23, 162, 184, 0.1);
    }

    .zyppts-toast-title,
    .zyppts-toast-message {
        color: var(--text-primary, #ffffff);
    }

    .zyppts-modal {
        background: var(--bg-primary, #1a1a1a);
    }

    .zyppts-modal-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .zyppts-modal-footer {
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    .zyppts-modal-title {
        color: var(--text-primary, #ffffff);
    }

    .zyppts-modal-body p {
        color: var(--text-secondary, #b0b0b0);
    }
}

/* Responsive – popups and modals */
@media (max-width: 576px) {
    .zyppts-toast-container {
        top: max(10px, env(safe-area-inset-top));
        right: max(10px, env(safe-area-inset-right));
        left: max(10px, env(safe-area-inset-left));
    }

    .zyppts-toast {
        min-width: auto;
        max-width: 100%;
    }

    .zyppts-modal-overlay {
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
        align-items: flex-start;
        padding-top: max(20px, env(safe-area-inset-top));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .zyppts-modal {
        max-width: 100%;
        width: 100%;
        margin: 0 auto 20px;
        max-height: calc(100vh - 40px);
        max-height: calc(100dvh - 40px);
    }

    .zyppts-modal-header {
        padding: 16px 20px;
    }

    .zyppts-modal-title {
        font-size: 16px;
    }

    .zyppts-modal-body {
        padding: 20px;
    }

    .zyppts-modal-footer {
        padding: 12px 20px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .zyppts-modal-footer .btn {
        min-width: 80px;
        padding: 10px 16px;
    }

    /* Touch-friendly close (ensure tap target ≥ 44px) */
    .zyppts-modal-header .btn-close,
    .zyppts-modal-header [data-bs-dismiss="modal"] {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
}

/* Auth modal overlay (used by base.js, subscription_plans, logo_processor) */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
}

.auth-modal {
    width: 100%;
    max-width: min(480px, calc(100vw - 32px));
    margin: auto;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 576px) {
    .auth-modal-overlay {
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
        align-items: flex-start;
    }

    .auth-modal {
        max-width: 100%;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
    }
}

/* Global Bootstrap modal responsive (index, queue, etc.) */
@media (max-width: 575.98px) {
    .modal.show {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    .modal-dialog {
        margin: max(12px, env(safe-area-inset-top)) auto max(12px, env(safe-area-inset-bottom));
        max-width: calc(100vw - 24px);
    }
    .modal-content {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    .modal-header .modal-title {
        font-size: 1.1rem;
    }
    .modal-footer .btn {
        min-width: 0;
    }
    .modal .btn-close {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
}
@media (max-width: 991.98px) {
    .modal-dialog.modal-lg {
        max-width: calc(100vw - 24px);
        margin-left: 12px;
        margin-right: 12px;
    }
}
