/* Original Button Styles - UNCHANGED */
.apqv-button {
    position: relative;
    background-color: #003087 !important;
    display: inline-block;
    padding: 10px 20px;
    font-size: 16px;
    line-height: 1.2;
    border: none;
    box-shadow: none;
    border-radius: 0px;
    text-decoration: none;
    outline: none;
    cursor: pointer;
}

.apqv-button .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-top: 2px solid transparent;
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    left: 40%;
    /* top: 50%; */
    transform: translateY(-50%);
    animation: apqvspin 1s linear infinite;
    opacity: 0;
}

.apqv-button.loading .spinner {
    opacity: 1; /* Show the spinner when loading */
}

.apqv-button.loading {
    color: transparent; /* Hide button text when loading */
}

@keyframes apqvspin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/*******************************************************
***********************Pop up css***********************
********************************************************/

/* Original Popup Styles - UNCHANGED */
#apqv-popup .popup-body-spinner {
    width: 50px;
    height: 50px;
    border: 2px solid rgba(0, 48, 135, 0.61);
    border-top: 2px solid transparent;
    border-radius: 50%;
    position: absolute;
    left: 45%;
    top: 45%;
    animation: apqvspin 1s linear infinite;
     display: none;
}

#apqv-popup .popup-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* DEFAULT: Keep original popup box size */
#apqv-popup .popup-content-wrapper {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 90vw;
    min-width: 60vw;
    min-height: 70vh;
    position: relative;
    z-index: 9999;
    overflow: hidden;
}

/* CONDITIONAL: Full-screen ONLY when calendar table is present */
#apqv-popup .popup-content-wrapper:has(.popup-calendar) {
    width: 95vw !important;
    height: 90vh !important;
    max-width: none !important;
    min-width: none !important;
    min-height: none !important;
    display: flex;
    flex-direction: column;
}

/* pop up content */
#apqv-popup .popup-content {
    display: flex;
    max-height: 70vh;
    gap: 20px;
    /*flex-wrap: wrap;*/
}

/* CONDITIONAL: Full-height content ONLY when calendar is present */
#apqv-popup .popup-content-wrapper:has(.popup-calendar) .popup-content {
    flex: 1;
    max-height: none;
    overflow: hidden;
}

#apqv-popup .popup-sidebar {
    /*display: flex;*/
    display: none; /** hide sidebar for all **/
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding-right: 10px;
    flex: 0 0 270px;
    border-right: 1px solid #e6e6e6;
}

#apqv-popup .popup-summary {
    border-left: 1px solid #e6e6e6;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    flex: 0 0 270px;
}

#apqv-popup .popup-sidebar-content, #apqv-popup .popup-sidebar-contact {
    text-align: center;
}

#apqv-popup .popup-available-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /*commented when removed sidepanel completely and added Available dates for [location]*/
    /*justify-content: center;*/
}

#apqv-popup .popup-progress-container {
    display: flex;
    gap: 10px;
}

#apqv-popup .popup-progress {
    height: 6px;
    width: 6px;
    background-color: rgba(0, 0, 0, 0.07);
    display: block;
    color: #8e97b3;
    text-decoration: none;
    position: relative;
    box-shadow: none;
    font-weight: 500;
}

#apqv-popup .popup-progress.active {
    background: #003087;
}

#apqv-popup .popup-sidebar-contact--question {
    color: #003087;
    font-size: 14px;
}

#apqv-popup .popup-sidebar-contact--email {
    color: #003087;
    font-size: 14px;
    text-decoration: underline;
}

#apqv-popup .popup-step-title {
    color: #003087;
    font-size: 18px;
}

#apqv-popup .popup-summary-title {
    color: #003087;
    font-size: 18px;
}

#apqv-popup .popup-body-title {
    color: #003087;
    font-size: 18px;
}

#apqv-popup .popup-step-description, #apqv-popup .popup-body-desc{
    color: #8e97b3;
    font-size: 14px;
}

#apqv-popup .popup-summary-description {
    font-size: 12px;
    border-bottom: 1px solid #e6e6e6;
}

#apqv-popup .popup-error {
    font-size: 12px;
    color: red;
}

/* DEFAULT: Keep original body wrapper size */
#apqv-popup .popup-body-wrapper {
    flex: 1;
    max-width: 90vw;
}

/* CONDITIONAL: Full-width ONLY when calendar is present */
#apqv-popup .popup-content-wrapper:has(.popup-calendar) .popup-body-wrapper {
    max-width: none;
    display: flex;
    flex-direction: column;
}

#apqv-popup .popup-icon {
    background-size: contain;
    height: 100px;
    width: 100px;
    background-repeat: no-repeat;
    margin: auto;
}

/* Close button */
#apqv-popup .popup-close {
    font-size: 1.5em;
    color: #333;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    right: 10px;
    top: 0;
    position: absolute;
}

#apqv-popup .popup-back-button {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    width: fit-content;
}
#apqv-popup .popup-back-button i {
    font-size: 5px;
}

/* CALENDAR STYLES with Always Visible Scrollbars */
#apqv-popup .popup-calendar-container {
    overflow: auto;
    background: white;
    position: relative;
    padding: 0;
    max-height: 50vh;
}

/* CONDITIONAL: Full-height calendar ONLY when calendar is present */
#apqv-popup .popup-content-wrapper:has(.popup-calendar) .popup-calendar-container {
    flex: 1;
    max-height: none;
}

/* ALWAYS VISIBLE SCROLLBARS - Firefox */
#apqv-popup .popup-calendar-container {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
    overflow: scroll !important; /* Force scrollbars to always show */
}

/* Ensure last row isn't obscured by floating scroll indicator */
#apqv-popup .popup-calendar-container {
    padding-bottom: 12px !important;
}

/* ALWAYS VISIBLE SCROLLBARS - Webkit browsers */
#apqv-popup .popup-calendar-container::-webkit-scrollbar {
    width: 14px;
    height: 14px;
    -webkit-appearance: none;
    display: block !important; /* Force scrollbars to always show */
}

#apqv-popup .popup-calendar-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 7px;
    border: 1px solid #e2e8f0;
}

#apqv-popup .popup-calendar-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 7px;
    border: 2px solid #f1f5f9;
    min-height: 40px;
    min-width: 40px;
}

#apqv-popup .popup-calendar-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

#apqv-popup .popup-calendar-container::-webkit-scrollbar-thumb:active {
    background: #64748b;
}

#apqv-popup .popup-calendar-container::-webkit-scrollbar-corner {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

/* Force both horizontal and vertical scrollbars to always be visible */
#apqv-popup .popup-calendar-container::-webkit-scrollbar:horizontal {
    height: 14px;
    display: block !important;
}

#apqv-popup .popup-calendar-container::-webkit-scrollbar:vertical {
    width: 14px;
    display: block !important;
}

#apqv-popup .popup-calendar {
    display: block !important;
    overflow: auto;
    margin-top: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#apqv-popup .popup-calendar table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    table-layout: fixed; /* Force table to fill width and distribute columns evenly */
}

/* Sticky time column */
#apqv-popup .popup-calendar td:nth-child(1), 
#apqv-popup .popup-calendar th:nth-child(1) {
    position: sticky;
    left: 0;
    background: #f8fafc;
    z-index: 3;
    border-right: 1px solid #e2e8f0;
    font-weight: 500;
    box-shadow: 1px 0 0 0 #e2e8f0;
}

/* Header styling */
#apqv-popup .popup-calendar th {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px 6px;
    font-weight: 500;
    font-size: 11px;
    color: #475569;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #f1f5f9;
    white-space: normal; /* Allow text wrapping for long room names */
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Table cells */
#apqv-popup .popup-calendar td {
    padding: 0;
    text-align: center;
    position: relative;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    font-size: 11px;
    font-weight: 400;
    height: 36px;
    transition: all 0.15s ease;
    vertical-align: middle;
    overflow: hidden;
}

/* Time column styling */
#apqv-popup .popup-calendar td:nth-child(1),
#apqv-popup .popup-calendar th:nth-child(1) {
    font-weight: 500;
    color: #475569;
    text-align: center;
    padding: 0 8px;
    width: 90px; /* Fixed width for time column */
    font-size: 11px;
    background: #f8fafc;
}

/* Available slots - Latepoint green with Roche blue hover */
#apqv-popup .popup-calendar td.popup-calendar-is-available {
    background: #dcfce7;
    color: #166534;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    border: 1px solid #bbf7d0;
}

#apqv-popup .popup-calendar td.popup-calendar-is-available span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 6px 3px;
    transition: all 0.15s ease;
}

#apqv-popup .popup-calendar td.popup-calendar-is-available:hover {
    background: #0d41cc;
    color: white;
    border-color: #0d41cc;
    z-index: 1;
}

#apqv-popup .popup-calendar td.popup-calendar-is-available:hover::before {
    content: attr(data-display);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

#apqv-popup .popup-calendar td.popup-calendar-is-available:hover span {
    opacity: 0;
}

/* Booked/unavailable slots */
#apqv-popup .popup-calendar td:not(.popup-calendar-is-available) {
    background: #f8fafc;
    color: #94a3b8;
    font-weight: 400;
}

#apqv-popup .popup-calendar td:not(.popup-calendar-is-available) span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 6px 3px;
}

/* Original Button Styles - UNCHANGED */
#apqv-popup .popup-button {
    background: #ffffff;
    border: 2px solid #E5E7EE;
    align-items: center;
    box-shadow: none;
    outline: none;
    padding: 10px 15px;
    color: #1f222b;
    font-size: 14px;
    border-radius: 5px;
    min-width: fit-content;
    /* height: fit-content; */
    /* flex: 1; */
    display: flex;
    gap: 10px;
    cursor: pointer;
}

img.popup-button-icon {
    height: 30px;
    width: 30px;
    border-radius: 5px;
}

#apqv-popup .popup-button span {
    transition: transform 0.2s ease-out;
    display: block;
}

#apqv-popup .popup-button:hover span {
    transform: translateX(3px);
}

#apqv-popup .popup-button-active, #apqv-popup .popup-button:hover {
    border-color: #4b64e8;
}

/* DEFAULT: Keep original popup body */
#apqv-popup .popup-body {
    font-size: 1em;
    color: #555;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    min-height: 250px;
    min-width: 250px;
    overflow: auto;
    margin-top: 10px;
    position: relative; /* to hold the spinner and floating indicator absolute position */
}

/* CONDITIONAL: Full-height body ONLY when calendar is present */
#apqv-popup .popup-content-wrapper:has(.popup-calendar) .popup-body {
    flex: 1;
    max-height: none;
    min-height: auto;
    min-width: auto;
    overflow: hidden;
}

/* Popup body content */
#apqv-popup .popup-input-password {
    border: 2px solid #cad2e0 !important;
    padding: 12px 10px 12px 10px !important;
    border-radius: 5px !important;
    background-color: #fff !important;
}

/* Popup body content */
#apqv-popup .popup-restriction-form {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Responsive design for table only - keep original popup responsive as is */
@media screen and (max-width: 768px) {
    #apqv-popup .popup-content-wrapper:has(.popup-calendar) {
        width: 98vw !important;
        height: 95vh !important;
        padding: 15px;
    }
    
    #apqv-popup .popup-calendar table {
        min-width: 1000px;
    }
    
    #apqv-popup .popup-calendar td {
        min-width: 85px;
        height: 36px;
    }
    
    #apqv-popup .popup-calendar th {
        padding: 10px 6px;
        font-size: 11px;
        min-width: 85px;
    }
    
    #apqv-popup .popup-calendar td:nth-child(1) {
        min-width: 70px;
        font-size: 11px;
    }
}

@media screen and (max-width: 630px) {
    #apqv-popup .popup-sidebar, #apqv-popup .popup-summary {
        display: none;
    }
}

@media screen and (max-width: 1180px) {
    #apqv-popup .popup-summary {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    #apqv-popup .popup-content-wrapper:has(.popup-calendar) {
        width: 100vw !important;
        height: 100vh !important;
        padding: 10px;
        border-radius: 0;
    }
    
    #apqv-popup .popup-calendar table {
        min-width: 900px;
    }
    
    #apqv-popup .popup-calendar td {
        min-width: 75px;
        height: 32px;
    }
    
    #apqv-popup .popup-calendar th {
        min-width: 75px;
        font-size: 10px;
    }
    
    #apqv-popup .popup-calendar td:nth-child(1) {
        min-width: 65px;
        font-size: 10px;
    }
}