/**
 * CarVendors - Call Me Feature Styles
 * Responsive modal and button styles (Site Theme Matched)
 *
 * @author  CarVendors Dev Team
 * @date    16 Feb 2026
 */

/* =================================
   CRITICAL: Prevent Layout Shift on Load
   Override header defaults FIRST
   ================================= */

/* Target the header-specific selector to prevent initial style conflict */
.hheader-style-v4 .btn .call-me-trigger,
.hheader-style-v4.five .btn .call-me-trigger {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 46px !important;
    line-height: 46px !important;
    padding: 0 28px !important;
    border-radius: 50px !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    background: linear-gradient(135deg, var(--theme-color1, #00c831) 0%, #00b826 100%) !important;
    box-shadow: 0 4px 15px rgba(0, 200, 49, 0.35) !important;
    box-sizing: border-box !important;
    will-change: transform, box-shadow;
    contain: layout;
}

/* =================================
   Call Me Button in Header
   ================================= */

.call-me-btn-wrap {
    margin-right: 10px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}

/* Make it prominent with green background - matches Login button styling */
.call-me-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    line-height: 46px;
    font-weight: 700;
    color: #ffffff !important;
    font-size: 15px;
    padding: 0 28px !important;
    border-radius: 50px !important;
    border: none !important;
    background: linear-gradient(135deg, var(--theme-color1, #00c831) 0%, #00b826 100%) !important;
    text-transform: capitalize;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 200, 49, 0.35);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
    will-change: transform, box-shadow;
}

.call-me-trigger::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    transition: left 0.3s ease;
    border-radius: 50px;
}

.call-me-trigger:hover {
    color: #ffffff !important;
    background: linear-gradient(135deg, #00b826 0%, #009620 100%) !important;
    box-shadow: 0 6px 20px rgba(0, 200, 49, 0.5);
    transform: translateY(-2px);
}

.call-me-trigger:hover::before {
    left: 100%;
}

.call-me-trigger:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 200, 49, 0.3);
}

.call-me-trigger svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Mobile icon-only optimization */
@media (max-width: 767px) {
    .call-me-btn-wrap {
        margin-right: 8px;
        height: 46px;
        display: inline-flex;
        align-items: center;
        box-sizing: border-box;
    }

    .call-me-trigger {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 46px !important;
        height: 46px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        gap: 0 !important;
        box-shadow: 0 4px 12px rgba(0, 200, 49, 0.35) !important;
        box-sizing: border-box !important;
    }

    .call-me-trigger span {
        display: none !important;
    }

    .call-me-trigger:hover {
        box-shadow: 0 6px 18px rgba(0, 200, 49, 0.5) !important;
    }

    .call-me-trigger svg {
        width: 20px;
        height: 20px;
        margin: 0;
    }
}

/* Ensure proper alignment with other header buttons */
.hheader-style-v4.five .right-box .btn {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    gap: 0;
}

.hheader-style-v4.five .right-box {
    display: flex;
    align-items: center;
    gap: 8px;
    height: auto;
}

/* Override header style for call-me button - ensure white text */
.hheader-style-v4.five .btn .call-me-trigger,
.hheader-style-v4.five .call-me-btn-wrap .call-me-trigger {
    color: #ffffff !important;
}

/* Prevent header styles from interfering with call-me button */
.hheader-style-v4 .btn .call-me-trigger {
    border-radius: 50px !important;
    border: none !important;
    padding: 0 28px !important;
    background: linear-gradient(135deg, var(--theme-color1, #00c831) 0%, #00b826 100%) !important;
}

/* =================================
   Modal Styling
   ================================= */

/* 
 * Bootstrap's auto-created .modal-backdrop is disabled via
 * data-bs-backdrop="false" on the modal element.
 * We use the #callMeModal element itself as the overlay.
 * When Bootstrap shows the modal, it becomes a fixed full-screen layer.
 * Clicking outside .modal-content (on #callMeModal) closes via JS.
 */
#callMeModal {
    z-index: 1055;
    background-color: transparent;
}

#callMeModal.show {
    background-color: rgba(5, 11, 32, 0.35);
}

#callMeModal .modal-content {
    pointer-events: auto;
    border-radius: 16px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Clean white header - no gradient */
#callMeModal .modal-header {
    background: #ffffff;
    color: var(--theme-color-dark, #050B20);
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid #e9ecef;
    padding: 16px 24px;
}

#callMeModal .modal-title {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--theme-color-dark, #050B20);
}

#callMeModal .btn-close {
    opacity: 0.5;
}

#callMeModal .btn-close:hover {
    opacity: 1;
}

#callMeModal .modal-body {
    padding: 20px 24px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

/* =================================
   Tab Navigation - Minimal underline style
   ================================= */

.call-me-tabs {
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 20px;
}

.call-me-tabs .nav-link {
    border: none;
    border-radius: 0;
    color: #6c757d;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    background: transparent;
}

.call-me-tabs .nav-link:hover {
    color: var(--theme-color1, #00c831);
    background: transparent;
}

.call-me-tabs .nav-link.active {
    color: var(--theme-color1, #00c831);
    background: transparent;
    border-bottom-color: var(--theme-color1, #00c831);
}

.call-me-tabs .nav-link svg {
    vertical-align: middle;
    margin-right: 6px;
}

/* =================================
   Call Now Tab Content
   ================================= */

.call-now-content {
    padding: 20px 16px;
}

.call-now-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {

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

    50% {
        transform: scale(1.05);
    }
}

.call-now-btn {
    font-size: 1.1rem;
    padding: 13px 24px;
    border-radius: 50px;
    font-weight: 700;
    transition: all 0.3s ease;
    background: var(--theme-color1, #00c831);
    border: none;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    box-shadow: 0 4px 14px rgba(0, 200, 49, 0.3);
    white-space: nowrap;
}

.call-now-btn:hover {
    background: var(--theme-color2, #00B67A);
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 200, 49, 0.25);
    color: white;
    text-decoration: none;
}

.call-now-icon svg {
    stroke: var(--theme-color1, #00c831);
}

/* =================================
   Schedule Form
   ================================= */

#scheduleCallForm .form-label {
    font-weight: 600;
    color: var(--theme-color-dark, #050B20);
    margin-bottom: 4px;
    font-size: 13px;
}

#scheduleCallForm .form-control,
#scheduleCallForm .form-select {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    color: var(--theme-color-dark, #050B20);
}

#scheduleCallForm .form-control:focus,
#scheduleCallForm .form-select:focus {
    border-color: var(--theme-color1, #00c831);
    box-shadow: 0 0 0 0.2rem rgba(0, 200, 49, 0.1);
    outline: none;
}

#scheduleCallForm .form-control.is-invalid,
#scheduleCallForm .form-select.is-invalid {
    border-color: #dc3545;
}

#scheduleCallForm .text-danger {
    color: #dc3545;
}

#scheduleCallForm .form-text {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 5px;
}

#scheduleSubmitBtn {
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 50px;
    background: var(--theme-color1, #00c831);
    border: none;
    transition: all 0.3s ease;
    color: white;
}

#scheduleSubmitBtn:hover:not(:disabled) {
    background: var(--theme-color2, #00B67A);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 200, 49, 0.25);
}

#scheduleSubmitBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#scheduleSubmitBtn .loading-spinner {
    display: none;
}

#scheduleSubmitBtn.loading .btn-text {
    display: none;
}

#scheduleSubmitBtn.loading .loading-spinner {
    display: inline-block;
}

/* =================================
   Confirmation State
   ================================= */

#scheduleConfirmation {
    padding: 20px 16px;
}

#scheduleConfirmation .alert-info {
    background: #e7f9f0;
    border: none;
    border-left: 4px solid var(--theme-color1, #00c831);
    padding: 16px 20px;
    font-size: 1.05rem;
    color: var(--theme-color-dark, #050B20);
}

#scheduleConfirmation svg {
    stroke: var(--theme-color1, #00c831);
}

/* =================================
   Toast Notifications
   ================================= */

#callMeToast {
    min-width: 300px;
}

#callMeToast .toast-header {
    background: var(--theme-color1, #00c831);
    color: white;
    font-weight: 600;
}

/* =================================
   Responsive - Tablet
   ================================= */

@media (max-width: 992px) {
    #callMeModal .modal-dialog {
        max-width: 90%;
        margin: 1.75rem auto;
    }

    .call-me-tabs .nav-link {
        padding: 12px 18px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    #callMeModal .modal-dialog {
        max-width: 95%;
    }
}

/* =================================
   Responsive - Mobile
   ================================= */

@media (max-width: 576px) {
    #callMeModal .modal-dialog {
        max-width: 100%;
        margin: 0;
        height: 100vh;
        display: flex;
        align-items: flex-end;
    }

    #callMeModal .modal-content {
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }

    #callMeModal .modal-header {
        border-radius: 20px 20px 0 0;
        padding: 14px 18px;
    }

    #callMeModal .modal-title {
        font-size: 1.15rem;
    }

    #callMeModal .modal-body {
        padding: 16px 18px;
        max-height: calc(90vh - 56px);
    }

    .call-me-tabs {
        margin-bottom: 14px;
    }

    .call-me-tabs .nav-link {
        font-size: 13px;
        padding: 8px 12px;
    }

    .call-me-tabs .nav-link svg {
        width: 14px;
        height: 14px;
    }

    .call-now-content {
        padding: 14px 8px;
    }

    .call-now-content h4 {
        font-size: 1.1rem;
    }

    .call-now-btn {
        font-size: 1rem;
        padding: 12px 18px;
        width: 100%;
        max-width: 100%;
        justify-content: center;
    }

    /* Schedule switch button on mobile */
    .schedule-switch-btn {
        width: 100%;
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    #scheduleCallForm .form-label {
        font-size: 12px;
        margin-bottom: 2px;
    }

    #scheduleCallForm .form-control,
    #scheduleCallForm .form-select {
        padding: 7px 10px;
        font-size: 13px;
    }

    #scheduleCallForm .mb-2 {
        margin-bottom: 0.35rem !important;
    }

    #scheduleSubmitBtn {
        width: 100%;
        padding: 11px 24px;
        font-size: 0.95rem;
    }

    #scheduleCallForm textarea {
        max-height: 60px;
        resize: none;
    }
}

/* =================================
   Mobile Menu Integration
   ================================= */

.call-me-mobile-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    color: #ffffff !important;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--theme-color1, #00c831) 0%, #00b826 100%);
    border-radius: 50px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0, 200, 49, 0.25);
    border: none;
}

.call-me-mobile-trigger:hover {
    background: linear-gradient(135deg, #00b826 0%, #009620 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 200, 49, 0.35);
    transform: translateX(2px);
}

.call-me-mobile-trigger svg {
    stroke: currentColor;
}


/* =================================
   Accessibility
   ================================= */

.call-me-trigger:focus,
.call-now-btn:focus,
#scheduleSubmitBtn:focus {
    outline: 3px solid rgba(0, 200, 49, 0.4);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* =================================
   Loading State
   ================================= */

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

/* Alert styles */
.alert {
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.alert-danger {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
}

.alert-info {
    background: #e7f9f0;
    border: 1px solid #c7eed9;
    color: var(--theme-color-dark, #050B20);
}

.alert-success {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
}