/* --- Sabreen Contact Widget Styles --- */
#support-widget-container { 
    position: fixed; 
    bottom: 16px; 
    right: 16px; 
    z-index: 1000; 
    font-family: 'Inter', sans-serif;
}

.support-toggle-button { 
    background-color: #2c2e74;
    color: #ffffff;
    width: 60px; 
    height: 60px; 
    border-radius: 9999px; 
    border: none; 
    cursor: pointer; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); 
    transition: transform 0.2s ease, background-color 0.2s ease; 
}

.support-toggle-button:hover { 
    transform: scale(1.1); 
    background-color: #1e2050;
}

.support-toggle-button .icon-close { display: none; }
.support-toggle-button.open .icon-close { display: block; }
.support-toggle-button.open .icon-open { display: none; }

.support-window { 
    position: absolute; 
    bottom: calc(100% + 16px); 
    right: 0; 
    width: 350px; 
    max-width: 350px; 
    background: #2c2e74;
    border-radius: 12px; 
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3); 
    overflow: hidden; 
    transform-origin: bottom right; 
    transform: scale(0); 
    opacity: 0; 
    transition: transform 0.3s ease, opacity 0.3s ease;
    /* NEW: Flex layout for scroll handling */
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
}

.support-window.open { transform: scale(1); opacity: 1; }

.support-header { 
    display: flex; 
    justify-content: flex-start; 
    align-items: center; 
    padding: 16px; 
    background-color: rgba(255, 255, 255, 0.08); 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    /* NEW: Prevent header from shrinking */
    flex-shrink: 0;
}

.widget-avatar {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
}
img.widget-avatar {
    width: 48px !important;
    height: 48px !important;
}
.support-header h3 { 
    margin: 0; 
    flex-grow: 1;
    font-size: 16px; 
    font-weight: 600; 
    color: #ffffff; 
    font-family: 'Poppins', sans-serif;
}

.support-body { 
    padding: 16px;
    /* NEW: Allow body to scroll when content overflows */
    overflow-y: auto;
    flex-grow: 1;
}

.support-screen { display: none; }
.support-screen.active { display: block; }
.support-screen p { color: #d1d2eb; margin-bottom: 16px; margin-top:16px; line-height: 1.6;font-size:14px !important; }

.support-form-fields {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.support-form-fields input,
.support-form-fields select { 
    width: 100%; 
    padding: 8px; 
    background-color: rgba(0, 0, 0, 0.2); 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    border-radius: 6px; 
    color: #ffffff; 
    font-size: 16px; 
    margin-bottom: 8px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.support-form-fields select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a7a9de' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 8px;
    padding-right: 8px;
}

.support-form-fields input:last-child,
.support-form-fields select:last-child {
    margin-bottom: 0;
}

.support-form-fields input::placeholder { color: #a7a9de; }
.support-form-fields select option {
    background-color: #2c2e74;
    color: #ffffff;
}

input.widget-text-field {
    margin-bottom:4px !important;
}

/* Button Styles */
.form-nav-button { 
    width: 100%;
    background-color: #f26622;
    border: none; 
    border-radius: 6px; 
    color: #ffffff;
    font-weight: 600; 
    cursor: pointer; 
    transition: background-color 0.2s ease;
}
.form-nav-button:hover { background-color: #d95b1e; }

.form-nav-container {
    display: flex;
    gap: 0.75rem;
}

.form-nav-button.prev-step {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.form-nav-button.prev-step:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}
.prev-step:hover, .next-step:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}
.prev-step:focus, .next-step:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
}
button.form-nav-button.prev-step:hover, button.form-nav-button.prev-step:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
}
button.form-nav-button.next-step:hover, button.form-nav-button.next-step:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.support-error-message {
    color: #f7baba;
    font-size: 0.875rem;
    margin-top: -8px;
    margin-bottom: 8px;
}
.support-error-message.hidden { display: none; }

.confirmation-message { text-align: center; padding: 1rem 0; }
.confirmation-message h4 { font-size: 1.25rem; margin-bottom: 8px; color: #fff; font-family: 'Poppins', sans-serif; }

.form-row-flex {
    display: flex !important;
    flex-direction: row !important;
    gap: 4px !important;
    margin-bottom: 4px;
}

.form-row-flex .widget-text-field {
    margin-bottom: 0;
}

/* ============================================
   RESPONSIVE FIXES FOR SMALLER SCREENS
   ============================================ */

/* Tablets and small laptops (height constraint) */
@media (max-height: 750px) {
    .support-window {
        max-height: calc(100vh - 100px);
    }
    
    .support-header {
        padding: 12px;
    }
    
    .support-body {
        padding: 12px;
    }
    
    .support-screen p {
        margin-top: 12px;
        margin-bottom: 12px;
    }
}

/* Very short viewports - reposition popup */
@media (max-height: 600px) {
    .support-window {
        position: fixed;
        bottom: 90px;
        right: 16px;
        top: 16px;
        max-height: none;
    }
    
    .support-header {
        padding: 10px;
    }
    
    .support-body {
        padding: 10px;
    }
    
    .support-screen p {
        margin-top: 8px;
        margin-bottom: 8px;
        font-size: 13px !important;
    }
    
    .widget-avatar {
        width: 40px !important;
        height: 40px !important;
    }
    
    img.widget-avatar {
        width: 40px !important;
        height: 40px !important;
    }
    
    .support-header h3 {
        font-size: 14px;
    }
}

/* Narrow screens (mobile and small tablets) */
@media (max-width: 400px) {
    #support-widget-container {
        right: 12px;
        bottom: 12px;
    }
    
    .support-window {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        right: 0;
    }
    
    .form-row-flex {
        flex-direction: column !important;
    }
}

/* Medium screens - slightly narrower widget */
@media (max-width: 500px) and (min-width: 401px) {
    .support-window {
        width: 320px;
        max-width: 320px;
    }
}