/* =================================================================== */
/* 🚀 ===== SWEETALERT2 ULTRA PREMIUM THEME ===== */
/* =================================================================== */

/* --- Base Container --- */
.swal2-container {
    z-index: 999999 !important;
    backdrop-filter: blur(5px);
    background-color: rgba(var(--black-rgb), 0.2);
}

/* --- Main Popup Structure --- */
.swal2-popup {
    font-family: var(--default-font-family) !important;
    max-width: 420px !important;
    min-width: 300px !important;
    border-radius: 20px !important;
    box-shadow: 0 25px 50px -12px rgba(var(--black-rgb), 0.25) !important;
    padding: 32px !important;
    background: linear-gradient(145deg, rgb(var(--white-rgb)) 0%, rgb(var(--light-rgb)) 100%) !important;
    border: 1px solid rgba(var(--white-rgb), 0.5) !important;
    overflow: hidden;
    position: relative;
}

/* Glossy highlight effect */
.swal2-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: radial-gradient(circle at 50% 0, rgba(var(--white-rgb), 0.35), rgba(var(--white-rgb), 0) 70%);
    pointer-events: none;
}

/* Dark Mode Popup */
[data-bs-theme="dark"] .swal2-popup {
    background: linear-gradient(145deg, rgb(38, 42, 48) 0%, rgb(var(--body-bg-rgb)) 100%) !important;
    border-color: rgba(var(--white-rgb), 0.1) !important;
}

/* --- Toast Notifications --- */
.swal2-toast {
    max-width: 360px !important;
    padding: 16px !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px -5px rgba(var(--black-rgb), 0.2) !important;
    background: rgba(var(--light-rgb), 0.85) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--white-rgb), 0.2) !important;
    display: flex !important;
    align-items: center !important;
}

[data-bs-theme="dark"] .swal2-toast {
    background: rgba(var(--light-rgb), 0.85) !important;
    border-color: rgba(var(--white-rgb), 0.1) !important;
}

/* --- Title & Content --- */
.swal2-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    margin: 0 0 10px 0 !important;
    color: rgb(var(--dark-rgb)) !important;
    padding: 0 !important;
    line-height: 1.4 !important;
    letter-spacing: -0.25px;
    text-align: center;
}

.swal2-title:not(:only-child)::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, rgb(var(--primary-rgb)) 0%, rgb(var(--purple-rgb)) 100%);
    margin: 16px auto 0;
    border-radius: 3px;
}

.swal2-html-container {
    font-size: 14px !important;
    margin: 12px 0 24px 0 !important;
    color: rgb(var(--text-muted-rgb)) !important;
    line-height: 1.6 !important;
    padding: 0 !important;
    text-align: center;
}

/* --- Icon Styling --- */
.swal2-icon {
    width: 64px !important;
    height: 64px !important;
    margin: 0 auto 20px !important;
    border: none !important;
    transform: scale(0.8);
}

.swal2-icon-content { font-size: 48px !important; }
.swal2-success-line-tip, .swal2-success-line-long { stroke-width: 3px !important; }
.swal2-error-x-mark span { stroke-width: 3px !important; }
.swal2-success-ring { border-color: rgba(var(--success-rgb), 0.3) !important; }
.swal2-success-fix { background-color: transparent !important; }
.swal2-success [class^='swal2-success-line'] { background-color: rgb(var(--success-rgb)) !important; }
.swal2-error [class^='swal2-x-mark-line'] { background-color: rgb(var(--danger-rgb)) !important; }
.swal2-warning { border-color: rgb(var(--warning-rgb)) !important; color: rgb(var(--warning-rgb)) !important; }
.swal2-info { border-color: rgb(var(--info-rgb)) !important; color: rgb(var(--info-rgb)) !important; }

/* Toast Icons */
.swal2-toast .swal2-icon {
    width: 32px !important;
    height: 32px !important;
    margin: 0 12px 0 0 !important;
    transform: scale(1);
}
.swal2-toast .swal2-title { font-size: 14px !important; margin: 0 !important; text-align: left; }
.swal2-toast .swal2-title::after { display: none; }
.swal2-toast .swal2-html-container { margin: 5px 0 0 0 !important; text-align: left; }


/* --- Action Buttons --- */
.swal2-actions {
    margin: 32px 0 0 0 !important;
    gap: 16px !important;
}

.swal2-styled {
    padding: 12px 24px !important;
    font-size: 14px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease-out !important;
    box-shadow: 0 4px 15px rgba(var(--black-rgb), 0.08) !important;
    border: none !important;
    background-size: 200% auto !important;
}
.swal2-styled:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(var(--black-rgb), 0.12) !important;
    background-position: right center !important;
}
.swal2-styled:active { transform: translateY(-1px); }

.swal2-confirm {
    background-image: linear-gradient(to right, rgb(var(--primary-rgb)) 0%, rgb(var(--purple-rgb)) 50%, rgb(var(--primary-rgb)) 100%) !important;
    color: rgb(var(--white-rgb)) !important;
}

.swal2-cancel {
    background-color: transparent !important;
    color: rgb(var(--text-muted-rgb)) !important;
    border: 1px solid rgb(var(--default-border-rgb)) !important;
    box-shadow: none !important;
}
.swal2-cancel:hover {
    background-color: rgba(var(--text-muted-rgb), 0.05) !important;
    color: rgb(var(--dark-rgb)) !important;
    border-color: rgb(var(--dark-rgb)) !important;
    box-shadow: none !important;
}

/* --- Progress Bar & Close Button --- */
.swal2-timer-progress-bar {
    height: 4px !important;
    background: linear-gradient(90deg, rgb(var(--primary-rgb)) 0%, rgb(var(--purple-rgb)) 100%) !important;
}
.swal2-close {
    color: rgb(var(--text-muted-rgb)) !important;
    font-size: 28px !important;
    transition: all 0.2s ease !important;
}
.swal2-close:hover {
    color: rgb(var(--danger-rgb)) !important;
    transform: rotate(90deg) scale(1.1);
}


/* --- Animations --- */
@keyframes swal-show-premium {
    0% { transform: scale(0.7) translateY(50px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes swal-toast-show-premium {
    0% { transform: translateX(100%) scale(0.8); opacity: 0; }
    100% { transform: translateX(0) scale(1); opacity: 1; }
}

.swal2-show { animation: swal-show-premium 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important; }
.swal2-hide { animation: swal2-hide 0.4s cubic-bezier(0.47, 0, 0.75, 0.72) forwards !important; }
.swal2-toast.swal2-show { animation: swal-toast-show-premium 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards !important; }
.swal2-toast.swal2-hide { animation: swal2-toast-hide 0.4s ease-in-out forwards !important; }


/* --- Responsive Adjustments --- */
@media (max-width: 500px) {
    .swal2-popup {
        width: 94vw !important;
        max-width: 94vw !important;
        padding: 24px 16px !important;
    }
    .swal2-actions { flex-direction: column; gap: 12px !important; }
    .swal2-styled { width: 100% !important; }
}



/* =================================================================== */
/* 📝 ===== FORM VALIDATION ERROR STYLING ===== */
/* =================================================================== */

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875em;
    font-weight: 500;
    color: rgb(var(--danger-rgb));
    opacity: 0;
    transform: translateY(-10px);
    animation: fadeInUp 0.3s 0.1s ease-out forwards;
    padding-left: 26px;
    position: relative;
}

.invalid-feedback::before {
    content: "!";
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    background-color: rgb(var(--danger-rgb));
    color: rgb(var(--white-rgb));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(var(--danger-rgb), 0.5);
}

.invalid-feedback strong {
    font-weight: 700;
}

/* Input error state */
.is-invalid {
    border-color: rgb(var(--danger-rgb)) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='rgb(230 57 70)'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='rgb(230 57 70)' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
.is-invalid:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--danger-rgb), 0.25) !important;
}

/* For select & password toggle compatibility */
select.is-invalid { background-position: right 1.75rem center; }
.input-group .is-invalid { background-position: right 2.5rem center; }
.input-group .invalid-feedback { margin-top: 0.25rem; }

/* Animation for error messages */
@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

/* Input shake animation */
@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* Dark Mode Overrides for Validation */
[data-bs-theme="dark"] .is-invalid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='rgb(255 107 107)'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='rgb(255 107 107)' stroke='none'/%3e%3c/svg%3e");
}


/* Custom CSS for equal height form elements */
.filter-form .form-control,
.filter-form .form-select,
.filter-form .filter-btn {
    height: calc(3.0rem + 3px); /* Standard Bootstrap input height (form-control-md) + border */
}

/* Adjust button padding if needed to match text baseline */
.filter-form .filter-btn {
    padding-top: .375rem;
    padding-bottom: .375rem;
}

/* Align buttons to the bottom if labels push inputs down */
.filter-form .align-items-end {
    align-items: flex-end;
}

/* General chart card style */
 .chart-card {
     background: #fff;
     border-radius: 12px;
     padding: 20px;
     margin-bottom: 25px;
     box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
     transition: all 0.3s ease-in-out;
 }

.chart-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.chart-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    border-left: 4px solid #5D87FF;
    padding-left: 10px;
}

/* Responsive grid for charts */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Adjust chart height if needed */
.apexcharts-canvas {
    max-width: 100% !important;
}

@media (max-width: 768px) {
    .chart-title {
        font-size: 16px;
    }

    .chart-card {
        padding: 15px;
    }
}

