/**
 * Bookly Cancel Appointment Fix - CSS Styles
 * Provides styling fixes for cancel appointment functionality
 */

/* Cancel button loading state */
.bookly-cancel-appointment:disabled,
.bookly-js-cancel-appointment:disabled,
[data-action="cancel_appointment"]:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    position: relative;
}

/* Loading spinner for cancel buttons */
.bookly-cancel-appointment:disabled::after,
.bookly-js-cancel-appointment:disabled::after,
[data-action="cancel_appointment"]:disabled::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: bookly-spin 1s linear infinite;
}

@keyframes bookly-spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Fix for customer cabinet table styling */
.bookly-customer-cabinet table {
    table-layout: auto !important;
}

.bookly-customer-cabinet .bookly-cancel-appointment,
.bookly-customer-cabinet [data-action="cancel_appointment"] {
    min-width: 80px;
    text-align: center;
    white-space: nowrap;
}

/* Modal styling fixes */
.bookly-js-modal-cancel-appointment {
    z-index: 99999 !important;
}

.bookly-js-modal-cancel-appointment .bookly-modal-content {
    background: white;
    border-radius: 5px;
    padding: 20px;
    max-width: 400px;
    margin: 0 auto;
}

/* Ensure buttons are visible and clickable */
.bookly-customer-cabinet button {
    pointer-events: auto !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Fix for overlapping elements */
.bookly-customer-cabinet .table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

/* Notification styling */
.bookly-cancel-notification {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 999999 !important;
    padding: 15px 20px !important;
    border-radius: 5px !important;
    color: white !important;
    font-weight: bold !important;
    max-width: 300px !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1) !important;
    animation: slideInRight 0.3s ease-out !important;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.bookly-cancel-notification.success {
    background-color: #28a745 !important;
}

.bookly-cancel-notification.error {
    background-color: #dc3545 !important;
}

.bookly-cancel-notification.info {
    background-color: #17a2b8 !important;
}

/* Fix for DataTable issues */
.bookly-customer-cabinet .dataTables_wrapper {
    overflow: visible !important;
}

.bookly-customer-cabinet .dataTables_scrollBody {
    overflow: visible !important;
}

/* Prevent cloneNode errors by ensuring elements exist */
.bookly-customer-cabinet table thead,
.bookly-customer-cabinet table tbody {
    display: table-header-group;
    display: table-row-group;
}

/* Ensure cancel buttons are always visible */
.bookly-customer-cabinet td:last-child {
    min-width: 100px;
    text-align: center;
}

/* Fix for responsive issues */
@media (max-width: 768px) {
    .bookly-cancel-notification {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        max-width: none !important;
        text-align: center !important;
    }
    
    .bookly-customer-cabinet .bookly-cancel-appointment,
    .bookly-customer-cabinet [data-action="cancel_appointment"] {
        min-width: 60px;
        font-size: 12px;
        padding: 5px 8px;
    }
}

/* Debug styles (remove in production) */
.bookly-debug-highlight {
    border: 2px solid red !important;
    background-color: rgba(255, 0, 0, 0.1) !important;
}

/* Override any conflicting styles */
.bookly-customer-cabinet button[disabled],
.bookly-customer-cabinet a[disabled] {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #fff !important;
}

/* Ensure proper z-index for modals */
.modal-backdrop {
    z-index: 99998 !important;
}

.modal {
    z-index: 99999 !important;
}

/* Fix for appointment status colors */
.bookly-customer-cabinet .status-cancelled {
    color: #dc3545 !important;
    font-weight: bold !important;
}

.bookly-customer-cabinet .status-approved {
    color: #28a745 !important;
}

.bookly-customer-cabinet .status-pending {
    color: #ffc107 !important;
}

/* Notification styles */
.bookly-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    z-index: 999999;
    min-width: 250px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.3s ease-out;
}

.bookly-notification.bookly-success {
    background-color: #28a745;
    border-left: 4px solid #1e7e34;
}

.bookly-notification.bookly-error {
    background-color: #dc3545;
    border-left: 4px solid #bd2130;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Ensure notifications appear above everything */
.bookly-notification {
    z-index: 999999 !important;
} 

/* Loading states for cancel buttons */
.bookly-cancel-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.bookly-cancel-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: bookly-spin 1s linear infinite;
}

@keyframes bookly-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* New Progress Indicator Styles */
.bookly-cancellation-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
}

.bookly-progress-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 250px;
}

.bookly-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: bookly-spin 1s linear infinite;
}

.bookly-progress-content p {
    margin: 0;
    font-size: 16px;
    color: #333;
}

/* New Confirmation Dialog Styles */
.bookly-cancel-confirmation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
}

.bookly-cancel-confirmation-dialog {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 400px;
    max-width: 500px;
    margin: 20px;
}

.bookly-cancel-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bookly-cancel-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.bookly-cancel-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

button.bookly-cancel-close {
    line-height: 0;
    font-size: 24px;
}

.bookly-cancel-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.bookly-cancel-body {
    padding: 20px;
}

.bookly-cancel-body p {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
}

.bookly-appointment-details {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
}

.bookly-cancel-footer {
    background: #f8f9fa;
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.bookly-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 80px;
}

.bookly-btn-cancel {
    background: #6c757d !important;
    background-color: #6c757d !important;
    color: white !important;
}

.bookly-btn-cancel:hover {
    background: #5a6268 !important;
    background-color: #5a6268 !important;
}

.bookly-btn-confirm {
    background: #dc3545 !important;
    background-color: #dc3545 !important;
    color: white !important;
}

.bookly-btn-confirm:hover {
    background: #bd2130 !important;
    background-color: #bd2130 !important;
}

/* Override Elementor styles for modal buttons */
.bookly-cancel-confirmation-overlay button.bookly-btn-cancel,
.elementor-kit-5 .bookly-cancel-confirmation-overlay button.bookly-btn-cancel {
    background: #6c757d !important;
    background-color: #6c757d !important;
}

.bookly-cancel-confirmation-overlay button.bookly-btn-cancel:hover,
.elementor-kit-5 .bookly-cancel-confirmation-overlay button.bookly-btn-cancel:hover {
    background: #5a6268 !important;
    background-color: #5a6268 !important;
}

.bookly-cancel-confirmation-overlay button.bookly-btn-confirm,
.elementor-kit-5 .bookly-cancel-confirmation-overlay button.bookly-btn-confirm {
    background: #dc3545 !important;
    background-color: #dc3545 !important;
}

.bookly-cancel-confirmation-overlay button.bookly-btn-confirm:hover,
.elementor-kit-5 .bookly-cancel-confirmation-overlay button.bookly-btn-confirm:hover {
    background: #bd2130 !important;
    background-color: #bd2130 !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .bookly-cancel-confirmation-dialog {
        min-width: 300px;
        margin: 10px;
    }
    
    .bookly-cancel-footer {
        flex-direction: column;
    }
    
    .bookly-btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .bookly-notification {
        left: 10px;
        right: 10px;
        width: auto;
    }
} 