/* COMPLETE MODAL REPLACEMENT SYSTEM */

/* AGGRESSIVE BOOTSTRAP MODAL BLOCKING */
.modal {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.modal-backdrop {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Only show modals that are explicitly marked as safe */
.modal.custom-modal-safe {
    display: block !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Hide all Bootstrap modals by default and replace with custom system */
.modal.bootstrap-disabled {
    display: none !important;
}

/* Custom modal system that bypasses Bootstrap entirely */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-modal.show {
    opacity: 1;
    visibility: visible;
}

.custom-modal-dialog {
    background: white;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    margin: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.custom-modal.show .custom-modal-dialog {
    transform: scale(1);
}

.custom-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.custom-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.custom-modal-close:hover {
    background-color: #f8f9fa;
}

.custom-modal-body {
    padding: 1.5rem;
}

.custom-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Emergency override styles */
.emergency-modal-override {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 99999 !important;
    background: white !important;
    border: 2px solid #dc3545 !important;
    border-radius: 8px !important;
    padding: 20px !important;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5) !important;
    max-width: 500px !important;
    width: 90% !important;
}

/* Force hide any problematic Bootstrap elements */
.modal-backdrop.force-hidden,
.modal.force-hidden,
.tooltip.force-hidden,
.popover.force-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Anti-freeze body styles */
body.anti-freeze {
    overflow: auto !important;
    position: static !important;
    padding-right: 0 !important;
    margin-right: 0 !important;
}

/* Force reset any stuck states */
.force-reset * {
    animation: none !important;
    transition: none !important;
    transform: none !important;
}

/* Emergency escape hatch */
.emergency-escape {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(255, 0, 0, 0.1) !important;
    z-index: 999999 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.emergency-escape-content {
    background: #dc3545 !important;
    color: white !important;
    padding: 20px !important;
    border-radius: 8px !important;
    text-align: center !important;
    font-size: 16px !important;
    font-weight: bold !important;
}

.emergency-escape-content:hover {
    background: #c82333 !important;
    transform: scale(1.05) !important;
}

/* Install Instructions Modal Styling */
.install-instructions .row {
    margin: 0 -10px;
}

.install-instructions .col-md-6 {
    padding: 0 10px;
}

.install-instructions ol {
    padding-left: 1.5rem;
}

.install-instructions ol li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.install-instructions h6 {
    border-bottom: 2px solid currentColor;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.install-instructions .bg-light {
    border-left: 4px solid #ffc107;
}

.install-instructions .border-start {
    border-left-width: 4px !important;
}

.install-instructions .fas,
.install-instructions .fab {
    width: 1.2em;
    text-align: center;
}

/* Delete Modal Styling */
.delete-confirmation {
    max-width: 100%;
}

.delete-confirmation .fa-exclamation-triangle {
    color: #dc3545;
    filter: drop-shadow(0 2px 4px rgba(220, 53, 69, 0.3));
}

/* Pulse animation for warning icon */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.delete-confirmation .alert-danger {
    border-left: 4px solid #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

.delete-confirmation .alert-warning {
    border-left: 4px solid #ffc107;
    background-color: rgba(255, 193, 7, 0.05);
}

.delete-confirmation .alert-dark {
    border-left: 4px solid #495057;
    background-color: rgba(73, 80, 87, 0.05);
}

.delete-confirmation .form-check {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    transition: border-color 0.3s ease;
}

.delete-confirmation .form-check:has(.form-check-input:checked) {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

.delete-confirmation .form-check-input:checked {
    background-color: #dc3545;
    border-color: #dc3545;
}

.delete-confirmation .form-check-label {
    font-weight: 500;
    color: #495057;
    cursor: pointer;
}

.delete-confirmation ul {
    padding-left: 1.2rem;
}

.delete-confirmation ul li {
    margin-bottom: 0.5rem;
    color: #495057;
}

/* Delete Button States */
.btn-danger:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    opacity: 0.65;
}

.btn-danger:not(:disabled):hover {
    background-color: #c82333;
    border-color: #bd2130;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Ensure delete buttons match the styling of other outline buttons */
.btn-outline-danger.btn-sm {
    border-width: 1px;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.2rem;
    transition: all 0.15s ease-in-out;
}

.btn-outline-danger:hover {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.25);
}

/* Make sure all button group buttons have consistent styling */
.btn-group .btn {
    transition: all 0.15s ease-in-out;
}

.btn-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

/* Header delete button styling */
.card-header .btn-outline-danger {
    border-color: #dc3545;
    color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
    transition: all 0.2s ease;
}

.card-header .btn-outline-danger:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.card-header .btn-outline-danger:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Ensure header elements align properly */
.card-header .d-flex.gap-2 {
    gap: 0.5rem !important;
}

/* Success/Error Modal Styling */
.fa-check-circle {
    color: #28a745;
    filter: drop-shadow(0 2px 4px rgba(40, 167, 69, 0.3));
}

.fa-exclamation-circle {
    color: #dc3545;
    filter: drop-shadow(0 2px 4px rgba(220, 53, 69, 0.3));
}
