/* Enhanced SweetAlert Styling */
.swal2-popup {
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 15px 30px rgba(204, 105, 17, 0.15);
    font-family: 'Prompt', sans-serif;
    border: none;
    max-width: 480px;
}

/* Container with blur effect */
.swal2-container {
    backdrop-filter: blur(8px);
    background-color: rgba(54, 54, 54, 0.4) !important;
}

/* Title with gradient text option */
.swal2-title {
    color: var(--font-color);
    font-size: var(--font-h1);
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.3;
}

.swal2-title.gradient-text {
    background: var(--btn-theme);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Content */
.swal2-html-container {
    color: var(--font-gray);
    font-size: var(--font-p);
    line-height: 1.6;
    margin-bottom: 28px;
}

/* Icon styling with animations */
.swal2-icon {
    border-width: 4px;
    margin: 0 auto 24px;
    position: relative;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
}

/* Success icon */
.swal2-icon.swal2-success {
    border-color: var(--green);
}

.swal2-icon.swal2-success [class^=swal2-success-line] {
    background-color: var(--green);
    height: 5px;
}

.swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(74, 167, 111, 0.3);
}

.swal2-icon.swal2-success::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--green-light);
    opacity: 0.4;
    animation: pulse 2s infinite;
    z-index: -1;
}

/* Error icon */
.swal2-icon.swal2-error {
    border-color: var(--red);
}

.swal2-icon.swal2-error [class^=swal2-x-mark-line] {
    background-color: var(--red);
    height: 5px;
}

.swal2-icon.swal2-error::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--red-light);
    opacity: 0.4;
    animation: pulse 2s infinite;
    z-index: -1;
}

/* Warning icon */
.swal2-icon.swal2-warning {
    border-color: var(--theme);
    color: var(--theme);
}

.swal2-icon.swal2-warning::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--theme-light);
    opacity: 0.4;
    animation: pulse 2s infinite;
    z-index: -1;
}

/* Info icon */
.swal2-icon.swal2-info {
    border-color: var(--logs-blue);
    color: var(--logs-blue);
}

.swal2-icon.swal2-info::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--logs-blue-light);
    opacity: 0.4;
    animation: pulse 2s infinite;
    z-index: -1;
}

/* Question icon */
.swal2-icon.swal2-question {
    border-color: var(--txt-blue);
    color: var(--txt-blue);
}

.swal2-icon.swal2-question::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(133, 124, 204, 0.2);
    opacity: 0.4;
    animation: pulse 2s infinite;
    z-index: -1;
}

/* Pulsing animation for icons */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.2;
    }

    100% {
        transform: scale(1);
        opacity: 0.4;
    }
}

/* Buttons container */
.swal2-actions {
    margin-top: 32px;
    gap: 16px;
    width: 100%;
    justify-content: center;
}

/* Confirm button - Primary action */
.swal2-styled.swal2-confirm {
    background: var(--btn-theme);
    color: var(--white);
    padding: 12px 28px;
    border-radius: 12px;
    font-size: var(--font-p);
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(255, 152, 61, 0.25);
    border: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    min-width: 120px;
}

/* Confirm button hover */
.swal2-styled.swal2-confirm:hover {
    background-color: #2c3e50 !important;
    /* สีเข้ม */
    color: white !important;
    /* ตัวอักษรสีขาวชัดเจน */
    transform: translateY(-3px) !important;
    box-shadow: none !important;
    background-image: none !important;
}

.swal2-styled.swal2-confirm:active {
    transform: translateY(-1px);
}

.swal2-styled.swal2-confirm::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.swal2-styled.swal2-confirm:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

/* Cancel button - Secondary action */
.swal2-styled.swal2-cancel {
    background-color: var(--secondary);
    color: var(--font-gray);
    padding: 12px 28px;
    border-radius: 12px;
    font-size: var(--font-p);
    font-weight: 500;
    box-shadow: none;
    border: 1px solid var(--td-border);
    transition: all 0.3s ease;
    min-width: 120px;
}

.swal2-styled.swal2-cancel:hover {
    background-color: #ecf0f1 !important;
    /* สีอ่อน */
    color: #2c3e50 !important;
    /* ตัวอักษรสีเข้ม */
    transform: translateY(-2px) !important;
    box-shadow: none !important;
    background-image: none !important;
}

.swal2-styled.swal2-cancel:active {
    transform: translateY(-1px);
}

/* Deny button - Destructive action */
.swal2-styled.swal2-deny {
    background-color: var(--red-pastel);
    color: var(--white);
    padding: 12px 28px;
    border-radius: 12px;
    font-size: var(--font-p);
    font-weight: 500;
    box-shadow: 0 8px 20px rgba(225, 55, 45, 0.2);
    border: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    min-width: 120px;
}

.swal2-styled.swal2-deny:hover {
    background-color: #c0392b !important;
    /* สีแดงเข้ม */
    color: white !important;
    /* ตัวอักษรสีขาวชัดเจน */
    transform: translateY(-3px) !important;
    box-shadow: none !important;
    background-image: none !important;
}


.swal2-styled.swal2-deny:active {
    transform: translateY(-1px);
}

/* Button ripple effect */
@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 1;
    }

    20% {
        transform: scale(25, 25);
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* Form elements */
.swal2-input,
.swal2-textarea,
.swal2-select {
    border: 2px solid var(--td-border);
    border-radius: 12px;
    font-size: var(--font-p);
    color: var(--font-color);
    padding: 16px;
    margin: 20px 0;
    transition: all 0.3s ease;
    background-color: var(--secondary-light);
}

.swal2-input:focus,
.swal2-textarea:focus,
.swal2-select:focus {
    border-color: var(--theme);
    box-shadow: 0 0 0 3px var(--theme-light);
    outline: none;
}

.swal2-input::placeholder,
.swal2-textarea::placeholder {
    color: var(--font-nonselect);
}

/* Radio & Checkbox */
.swal2-radio,
.swal2-checkbox {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.swal2-radio label,
.swal2-checkbox label {
    color: var(--font-color);
    font-size: var(--font-p);
    margin-right: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.swal2-radio input,
.swal2-checkbox input {
    accent-color: var(--theme);
    width: 18px;
    height: 18px;
}

/* Progress steps */
.swal2-progress-steps {
    margin: 0 0 24px;
}

.swal2-progress-steps .swal2-progress-step {
    background: var(--theme-light);
    width: 2.5em;
    height: 2.5em;
    line-height: 2.5em;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step {
    background: var(--theme);
    box-shadow: 0 0 15px rgba(255, 152, 61, 0.4);
}

.swal2-progress-steps .swal2-progress-step-line {
    background: var(--theme-light);
    height: 3px;
}

/* Timer progress bar */
.swal2-timer-progress-bar {
    background: var(--theme-light);
    height: 5px;
    border-radius: 2.5px;
}

/* Close button */
.swal2-close {
    color: var(--font-gray);
    font-size: var(--font-h2);
    transition: all 0.3s ease;
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swal2-close:hover {
    color: var(--font-color);
    transform: rotate(90deg);
    background-color: var(--secondary-light);
}

/* Animation */
.swal2-show {
    animation: swal2-show 0.35s cubic-bezier(0.18, 1.25, 0.4, 1);
}

.swal2-hide {
    animation: swal2-hide 0.25s forwards;
}

@keyframes swal2-show {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes swal2-hide {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.9);
        opacity: 0;
    }
}

/* Toast variation */
.swal2-popup.swal2-toast {
    padding: 16px 24px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: auto;
    max-width: 400px;
}

.swal2-popup.swal2-toast .swal2-title {
    margin: 0;
    font-size: var(--font-h5);
    text-align: left;
}

.swal2-popup.swal2-toast .swal2-html-container {
    margin: 5px 0 0 0;
    font-size: var(--font-small);
    text-align: left;
}

.swal2-popup.swal2-toast .swal2-icon {
    width: 28px;
    height: 28px;
    margin: 0;
}

.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content {
    font-size: 18px;
}

.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line] {
    height: 2px;
}

.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip] {
    width: 9px;
    left: 4px;
    top: 10px;
}

.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long] {
    width: 15px;
    right: 3px;
    top: 8px;
}

.swal2-popup.swal2-toast .swal2-close {
    right: 5px;
    top: 5px;
}

.swal2-popup.swal2-toast .swal2-actions {
    margin: 0;
    flex-shrink: 0;
    height: auto;
}

.swal2-popup.swal2-toast .swal2-styled.swal2-confirm,
.swal2-popup.swal2-toast .swal2-styled.swal2-cancel,
.swal2-popup.swal2-toast .swal2-styled.swal2-deny {
    padding: 8px 16px;
    font-size: var(--font-small);
    min-width: auto;
    border-radius: 8px;
}

/* Light and dark theme variations */
.swal2-popup.swal2-modal.swal2-light {
    background-color: var(--white);
}

.swal2-popup.swal2-modal.swal2-dark {
    background-color: #363636;
    border: 1px solid #4d4d4d;
}

.swal2-popup.swal2-modal.swal2-dark .swal2-title,
.swal2-popup.swal2-modal.swal2-dark .swal2-html-container {
    color: var(--white);
}

.swal2-popup.swal2-modal.swal2-dark .swal2-close {
    color: #bbbbbb;
}

.swal2-popup.swal2-modal.swal2-dark .swal2-close:hover {
    color: var(--white);
    background-color: #4d4d4d;
}

/* Custom background variations */
.swal2-popup.swal2-success-bg {
    background-color: var(--green-light);
}

.swal2-popup.swal2-error-bg {
    background-color: var(--red-light);
}

.swal2-popup.swal2-warning-bg {
    background-color: var(--theme-light);
}

.swal2-popup.swal2-info-bg {
    background-color: var(--logs-blue-light);
}

/* Glass morphism effect for modern look */
.swal2-popup.glass-effect {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.swal2-popup.glass-effect.swal2-dark {
    background: rgba(54, 54, 54, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(77, 77, 77, 0.3);
}

/* Loading animation enhancement */
.swal2-container.swal2-shown .swal2-backdrop-show {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* Full width content option */
.swal2-popup.full-width-content .swal2-html-container,
.swal2-popup.full-width-content .swal2-content {
    width: 100%;
}

/* Footer text styling */
.swal2-footer {
    font-size: var(--font-small);
    color: var(--font-gray);
    border-top: 1px solid var(--td-border);
    padding-top: 16px;
    margin-top: 24px;
}

/* Custom classes for different button arrangements */
.swal2-actions.buttons-end {
    justify-content: flex-end;
}

.swal2-actions.buttons-start {
    justify-content: flex-start;
}

.swal2-actions.buttons-space-between {
    justify-content: space-between;
}

/* Equal width buttons */
.swal2-actions.equal-width-buttons .swal2-styled {
    flex: 1;
}

/* Add accessibility focus states */
.swal2-styled:focus {
    outline: 2px solid var(--theme-light);
    outline-offset: 2px;
}

.swal2-styled:focus:not(:focus-visible) {
    outline: none;
}

/* Mobile responsiveness improvements */
@media (max-width: 500px) {
    .swal2-popup {
        padding: 24px;
        width: calc(100% - 40px);
        max-width: none;
    }

    .swal2-title {
        font-size: var(--font-h2);
    }

    .swal2-actions {
        flex-direction: column;
        width: 100%;
    }

    .swal2-styled.swal2-confirm,
    .swal2-styled.swal2-cancel,
    .swal2-styled.swal2-deny {
        width: 100%;
        margin: 0;
    }
}
