/* Custom styles for QlmCustomerSiteNetCore */

/* ===========================================
   HEADER2 MARGIN FIX
   =========================================== */

/* Reduce the excessive top margin on the registration caption (header2)
   The is2.css sets margin-top: 70px which creates too much space below the header */
.header2 {
    margin-top: 20px !important;
}

/* ===========================================
   FORM INPUT MARGIN FIX
   =========================================== */

/* Remove extra margin-bottom from email/tel inputs since spacing is handled by row structure.
   The is2.css applies margin-bottom: 18px to input[type=email] and input[type=tel] but not to 
   input[type=text], causing inconsistent spacing. Using !important to override. */
input[type="email"],
input[type="tel"] {
    margin-bottom: 0 !important;
}

/* Make email/tel inputs match the Bootstrap .form-control styling used by text inputs.
   The is2.css applies different border (2px solid #c2d1dc) and smaller font (0.875em) to these. */
input[type="email"].form-control,
input[type="tel"].form-control {
    font-size: 1rem !important;
    border: 1px solid #ced4da !important;
}

/* Hide validation spans when they are valid (empty) to prevent extra vertical space.
   ASP.NET Core adds 'field-validation-valid' class when there's no error message. */
.validatorError.field-validation-valid {
    display: none !important;
}

/* ===========================================
   CONSENT LINK FONT SIZE FIX
   =========================================== */

/* Make consent link text match the surrounding text size.
   The is2.css sets a fixed 12px for .consentLink a, but we want it to inherit
   from the parent .label_light which is 0.875em (14px) */
.consentLink a,
.consentLink a:link,
.consentLink a:visited,
.consentLink a:active,
.consentLink a:hover {
    font-size: inherit !important;
}

/* ===========================================
   CHECKBOX ALIGNMENT FIX
   =========================================== */

/* Ensure both subscribe and consent checkboxes are perfectly aligned */
.left-checkbox {
    display: flex;
    align-items: flex-start;
    margin-left: 0px !important;
    margin-top: 0px !important;
    margin-bottom: 0px !important;
    text-indent: 0px !important;
    padding-left: 10px;
}

.left-checkbox .largeCheckbox {
    display: flex;
    align-items: flex-start;
    width: 100%;
    margin: 0;
}

.left-checkbox .largeCheckbox input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 0px !important;
    margin-left: 0px !important;
    margin-right: 10px;
    position: static !important;
}

.left-checkbox .label_light {
    flex: 1;
    margin: 0;
    padding-top: 2px;
    line-height: 1.4;
}

/* ===========================================
   VERTICAL RESPONSIVENESS - Base Layout
   =========================================== */

html {
    height: 100%;
    overflow-y: auto;
}

body {
    background-color: #f5f5f5;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Responsive container adjustments */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
}

/* Vertical space adjustments for short screens */
@media (max-height: 700px) {
    body {
        padding: 10px;
    }
}

@media (max-height: 500px) {
    body {
        padding: 5px;
    }
}

.topDivForIFrame {
    max-width: 960px;
    width: 100%; /* Make container fluid */
    margin: 20px auto;
    padding: 0;
    border: 1px solid #ccc;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    top: auto;
    left: auto;
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden;
    max-height: calc(100vh - 40px); /* Limit height to viewport with margin */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .topDivForIFrame {
        margin: 10px auto;
        max-width: 100%;
        max-height: calc(100vh - 20px);
    }
}

/* Vertical adjustments for short screens */
@media (max-height: 700px) {
    .topDivForIFrame {
        margin: 10px auto;
        max-height: calc(100vh - 20px);
    }
}

@media (max-height: 500px) {
    .topDivForIFrame {
        margin: 5px auto;
        max-height: calc(100vh - 10px);
    }
}

.container-fluid {
    padding: 0 !important;
    margin: 0 !important;
    background-color: #ffffff;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.header {
    padding: 15px 20px;
    margin: 0 !important;
    width: 100%;
    background: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 50%, #ffffff 100%) !important;
    border-radius: 0 !important;
    position: relative;
    box-sizing: border-box;
    flex-shrink: 0; /* Prevent header from shrinking */
}

/* Responsive header for mobile */
@media (max-width: 768px) {
    .header {
        padding: 10px 15px;
    }
}

/* Compact header for short screens */
@media (max-height: 700px) {
    .header {
        padding: 10px 15px;
    }
}

@media (max-height: 500px) {
    .header {
        padding: 8px 12px;
    }
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    width: 100%;
    flex-wrap: nowrap;
}

/* Stack header content on very small screens */
@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        align-items: center;
    }
}

/* Compact header on short screens */
@media (max-height: 500px) {
    .header-content {
        min-height: auto;
    }
}

.logo-container {
    flex: 0 0 auto;
    margin-right: 15px;
}

@media (max-width: 480px) {
    .logo-container {
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* Smaller logo on short screens */
@media (max-height: 600px) {
    .logo-container img {
        max-width: 48px !important;
        max-height: 48px !important;
    }
}

@media (max-height: 500px) {
    .logo-container img {
        max-width: 40px !important;
        max-height: 40px !important;
    }
}

.title-container {
    flex: 1 1 auto;
    text-align: center;
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
}

/* Make title position relative on mobile for better stacking */
@media (max-width: 480px) {
    .title-container {
        position: relative;
        width: 100%;
        margin-bottom: 10px;
    }
}

.title-container .center-title {
    text-align: center !important;
    margin: 0 !important;
    display: inline-block !important;
    font-size: 1.5em;
}

/* Responsive font sizes */
@media (max-width: 768px) {
    .title-container .center-title {
        font-size: 1.3em;
    }
}

@media (max-width: 480px) {
    .title-container .center-title {
        font-size: 1.1em;
    }
}

/* Smaller title on short screens */
@media (max-height: 600px) {
    .title-container .center-title {
        font-size: 1.2em;
    }
}

@media (max-height: 500px) {
    .title-container .center-title {
        font-size: 1em;
    }
}

.language-container {
    flex: 0 0 auto;
    position: relative;
    z-index: 10;
}

@media (max-width: 480px) {
    .language-container {
        width: 100%;
        display: flex;
        justify-content: center;
    }
}

.language-container select {
    background-color: white;
    pointer-events: auto;
}

.topright-align {
    margin: 0;
    min-width: 120px;
    width: auto;
}

@media (max-width: 480px) {
    .topright-align {
        min-width: 150px;
    }
}

.center {
    padding: 0 20px 20px 20px;
    background-color: #ffffff;
    width: 100%;
    box-sizing: border-box;
    flex: 1 1 auto; /* Allow to grow and shrink */
    overflow-y: auto; /* Enable scrolling if content is too tall */
}

/* Responsive padding for center content */
@media (max-width: 768px) {
    .center {
        padding: 0 15px 15px 15px;
    }
}

@media (max-width: 480px) {
    .center {
        padding: 0 10px 10px 10px;
    }
}

/* Compact padding on short screens */
@media (max-height: 700px) {
    .center {
        padding: 0 15px 10px 15px;
    }
}

@media (max-height: 500px) {
    .center {
        padding: 0 10px 5px 10px;
    }
}

/* ===========================================
   VERTICAL SPACING MANAGEMENT
   =========================================== */

/* Reduce vertical spacing on short screens */
.row {
    margin-left: 0;
    margin-right: 0;
}

@media (max-height: 700px) {
    .row {
        margin-bottom: 8px;
    }
    
    /* Reduce empty row spacing */
    .row:has(.col-sm-12:empty),
    .row > .col-sm-12:only-child:empty {
        margin-bottom: 4px;
        min-height: 8px;
    }
}

@media (max-height: 500px) {
    .row {
        margin-bottom: 5px;
    }
    
    /* Further reduce empty row spacing */
    .row:has(.col-sm-12:empty),
    .row > .col-sm-12:only-child:empty {
        margin-bottom: 2px;
        min-height: 5px;
    }
}

/* ===========================================
   FORM CONTROLS VERTICAL RESPONSIVENESS
   =========================================== */

/* Form controls responsive styling */
.form-control,
.form-select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Compact form controls on short screens */
@media (max-height: 600px) {
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    textarea {
        padding: 8px;
        font-size: 14px;
    }
}

@media (max-height: 500px) {
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    textarea {
        padding: 6px;
        font-size: 13px;
    }
}

/* ===========================================
   BUTTON VERTICAL RESPONSIVENESS
   =========================================== */

/* Button responsive styling */
.btn {
    padding: 10px 20px;
    font-size: 1em;
}

@media (max-width: 768px) {
    .btn {
        padding: 12px 24px;
        font-size: 1.1em;
        width: 100%;
        margin-top: 10px;
    }
}

/* Compact buttons on short screens */
@media (max-height: 600px) {
    .btn {
        padding: 8px 16px;
        font-size: 0.95em;
    }
}

@media (max-height: 500px) {
    .btn {
        padding: 6px 12px;
        font-size: 0.9em;
    }
}

/* ===========================================
   ALERT BOXES VERTICAL RESPONSIVENESS
   =========================================== */

/* Alert boxes responsive */
.alert {
    margin: 15px 0;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .alert {
        font-size: 0.9em;
        padding: 12px;
    }
}

/* Compact alerts on short screens */
@media (max-height: 600px) {
    .alert {
        margin: 10px 0;
        padding: 10px;
        font-size: 0.85em;
    }
}

@media (max-height: 500px) {
    .alert {
        margin: 8px 0;
        padding: 8px;
        font-size: 0.8em;
    }
}

/* ===========================================
   IMAGES VERTICAL RESPONSIVENESS
   =========================================== */

/* Images responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Smaller images on short screens */
@media (max-height: 600px) {
    .center img:not(.logo-responsive) {
        max-height: 80px;
    }
}

@media (max-height: 500px) {
    .center img:not(.logo-responsive) {
        max-height: 60px;
    }
}

/* ===========================================
   SCROLLBAR STYLING
   =========================================== */

/* Custom scrollbar for better UX */
.topDivForIFrame::-webkit-scrollbar,
.center::-webkit-scrollbar {
    width: 8px;
}

.topDivForIFrame::-webkit-scrollbar-track,
.center::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.topDivForIFrame::-webkit-scrollbar-thumb,
.center::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.topDivForIFrame::-webkit-scrollbar-thumb:hover,
.center::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===========================================
   FORM CHECK (CHECKBOX) ADJUSTMENTS
   =========================================== */

/* Compact checkboxes on short screens */
@media (max-height: 600px) {
    .form-check {
        margin-bottom: 8px;
    }
    
    .form-check-label {
        font-size: 0.9em;
    }
}

@media (max-height: 500px) {
    .form-check {
        margin-bottom: 5px;
    }
    
    .form-check-label {
        font-size: 0.85em;
    }
}

/* ===========================================
   DROPDOWN FIX - Prevent clipping of select options
   =========================================== */

/* Ensure select dropdowns can overflow their containers */
select.form-control {
    position: relative;
    z-index: 100;
}

/* Allow the center container to show overflow when select is focused */
.center:has(select:focus) {
    overflow: visible;
}

/* Alternative: Increase the row containing the country dropdown */
.row:has(select.form-control) {
    position: relative;
    z-index: 50;
}

/* Ensure .topDivForIFrame doesn't clip dropdown options */
.topDivForIFrame:has(select:focus) {
    overflow: visible;
}

/* ===========================================
   CUSTOM DROPDOWN - Country Select
   =========================================== */

.custom-dropdown {
    position: relative;
    width: 100%;
    font-size: 1rem;
}

.custom-dropdown-selected {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    background-color: #fff;
    cursor: pointer;
    min-height: 38px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    position: relative;
}

.custom-dropdown-selected input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    background: transparent;
    cursor: pointer;
    width: 100%;
}

.custom-dropdown-selected input:not([readonly]) {
    cursor: text;
}

.custom-dropdown-selected input::placeholder {
    color: #6c757d;
    opacity: 1;
}

.custom-dropdown-selected:hover {
    border-color: #86b7fe;
}

.custom-dropdown.open .custom-dropdown-selected,
.custom-dropdown-selected:has(input:focus) {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.custom-dropdown-arrow {
    font-size: 1.5em;
    color: #6c757d;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 10px;
    margin-right: 10px;
    line-height: 1;
    pointer-events: none;
}

.custom-dropdown.open .custom-dropdown-arrow {
    transform: rotate(180deg);
}

.custom-dropdown-selected:hover .custom-dropdown-arrow {
    color: #495057;
}

.custom-dropdown-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 280px; /* Approximately 10 items at ~28px each */
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 0.25rem 0.25rem;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: -1px;
}

.custom-dropdown.open .custom-dropdown-options {
    display: block;
}

.custom-dropdown-search {
    position: sticky;
    top: 0;
    background-color: #fff;
    padding: 8px;
    border-bottom: 1px solid #e9ecef;
    z-index: 1001;
}

.custom-dropdown-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}

.custom-dropdown-search input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.custom-dropdown-option {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.custom-dropdown-option:hover {
    background-color: #e9ecef;
}

.custom-dropdown-option.selected {
    background-color: #0d6efd;
    color: white;
}

.custom-dropdown-option.selected:hover {
    background-color: #0b5ed7;
}

/* Custom scrollbar for dropdown options */
.custom-dropdown-options::-webkit-scrollbar {
    width: 8px;
}

.custom-dropdown-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 0 0.25rem 0;
}

.custom-dropdown-options::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.custom-dropdown-options::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive adjustments for custom dropdown */
@media (max-height: 600px) {
    .custom-dropdown-options {
        max-height: 200px; /* Show fewer items on shorter screens */
    }
    
    .custom-dropdown-option {
        padding: 6px 10px;
        font-size: 0.9em;
    }

    .custom-dropdown-selected input {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}

@media (max-height: 500px) {
    .custom-dropdown-options {
        max-height: 150px;
    }
    
    .custom-dropdown-option {
        padding: 5px 8px;
        font-size: 0.85em;
    }

    .custom-dropdown-selected input {
        padding: 5px 8px;
        font-size: 0.85rem;
    }
}
