/**
 * Complete Custom CSS for Joomla 5 Site with Cassiopeia Template
 * Norfolk Freemasons - Registration & Login System
 *
 * This file contains custom styles for header, navigation, forms,
 * RSForm! Pro integration, and Community Builder styling.
 */

/* ==========================================================================
   1. Header & Navigation Styles
   ========================================================================== */

/*
 * This is the definitive fix. We are overriding the template's core
 * background property directly on the header element. This tells Cassiopeia
 * to use a solid white background, removing any colors or gradients.
*/
.container-header {
    background: #ffffff !important;
}

/* Center the heading logo and brand text */
.navbar-brand {
    margin: auto;
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: black;
}

/* Center site description and set font color */
.container-header .site-description {
    color: black;
    white-space: normal;
    font-size: 1rem;
    text-align: center;
}

/* Set the main menu text font color to black */
.container-header .mod-menu {
    color: black;
}

/* Style the mobile hamburger menu icon */
.container-header .navbar-toggler {
    color: black;
    cursor: pointer;
}

/* ==========================================================================
   2. General Layout & Image Text Overlay Styles
   ========================================================================== */

/* Container for positioning text over images */
.site-grid .container {
    position: relative;
    text-align: center;
    color: black;
}

/* Position text in the bottom-left corner */
.bottom-left {
    position: absolute;
    bottom: 8px;
    left: 16px;
}

/* Position text in the top-left corner */
.top-left {
    position: absolute;
    top: 8px;
    left: 16px;
}

/* Position text in the top-right corner */
.top-right {
    position: absolute;
    top: 8px;
    right: 16px;
}

/* Position text in the bottom-right corner */
.bottom-right {
    position: absolute;
    bottom: 8px;
    right: 16px;
}

/* Position text directly in the center */
.centered {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ==========================================================================
   3. Community Builder Form Styles (CB Login, CB Registration, etc.)
   ========================================================================== */

/* --- Common CB Form Container Styling --- */
.cbLoginForm,
.cbRegistration,
.com_comprofiler form,
#cbcheckedadminForm {
    background-color: #f9f9f9 !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

/* --- CB Login Form Elements --- */

/* Establish positioning context for icons inside input fields */
.cbLoginForm .input-group {
    position: relative !important;
}

/* Make the input field take up all available space, and add padding for the icon */
.cbLoginForm .input-group .form-control {
    flex-grow: 1 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-right: 3rem !important; /* Space for the icon */
}

/* Position icons over the input field instead of next to it */
.cbLoginForm .input-group .input-group-text,
.cbLoginForm .input-group .input-password-toggle {
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    height: 100% !important;
    width: 3rem; /* Give it a fixed width to align icons */
    justify-content: center; /* Center the icon horizontally */
    z-index: 4 !important;
    background: transparent !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
}

/* Ensure the password toggle button doesn't look like a standard button */
.cbLoginForm .input-group .input-password-toggle {
    padding: 0 !important;
    margin: 0 !important;
}

/* Ensure login buttons are the same full width and add spacing */
.cbLoginForm .mod-login__submit {
    margin-bottom: 10px !important;
}
.cbLoginForm .mod-login__submit .btn {
    width: 100% !important;
    box-sizing: border-box !important; /* Include padding and border in the element's total width */
    padding: 10px 24px !important; /* Match registration button padding */
    font-size: 16px !important; /* Match registration button font size */
}

/* --- CB Registration Form Elements --- */

/* Common styles for all screen sizes */
.com_comprofiler .cb_form_line,
.com_comprofiler .cbFieldIcons,
#cbcheckedadminForm .cb_form_line,
#cbcheckedadminForm .cbFieldIcons {
    display: block !important;
    width: auto !important;
    margin-bottom: 15px !important;
}

/* Checkboxes and radio buttons */
.com_comprofiler input[type="checkbox"],
.com_comprofiler input[type="radio"],
#cbcheckedadminForm input[type="checkbox"],
#cbcheckedadminForm input[type="radio"] {
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    height: 16px !important;
    margin-right: 8px !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

/* Labels for checkboxes and radio buttons */
.com_comprofiler input[type="checkbox"] + label,
.com_comprofiler input[type="radio"] + label,
#cbcheckedadminForm input[type="checkbox"] + label,
#cbcheckedadminForm input[type="radio"] + label,
.com_comprofiler .cbSnglCtrlLbl label,
#cbcheckedadminForm .cbSnglCtrlLbl label {
    text-align: left !important;
    white-space: normal !important;
    width: auto !important;
    display: inline !important;
}

/* Submit buttons */
.com_comprofiler input[type="submit"],
.com_comprofiler button[type="submit"],
#cbcheckedadminForm input[type="submit"],
#cbcheckedadminForm button[type="submit"] {
    width: auto !important;
    padding: 10px 24px !important;
    margin-top: 15px !important;
    font-size: 16px !important;
}

/* Required field asterisks */
.com_comprofiler .cbStar,
#cbcheckedadminForm .cbStar {
    color: #cc0000 !important;
    margin-left: 3px !important;
}

/* Focus states for better accessibility */
.com_comprofiler input:focus,
.com_comprofiler select:focus,
.com_comprofiler textarea:focus,
#cbcheckedadminForm input:focus,
#cbcheckedadminForm select:focus,
#cbcheckedadminForm textarea:focus {
    border-color: #0066cc !important;
    outline: none !important;
    box-shadow: 0 0 5px rgba(0, 102, 204, 0.3) !important;
}

/* Special handling for checkbox containers */
.com_comprofiler .cbSnglCtrlLbl,
#cbcheckedadminForm .cbSnglCtrlLbl {
    display: inline-block !important;
    width: auto !important;
}

.com_comprofiler .cbSnglCtrlLbl input[type="checkbox"],
#cbcheckedadminForm .cbSnglCtrlLbl input[type="checkbox"] {
    float: left !important;
    margin-top: 2px !important;
}

.com_comprofiler .cbSnglCtrlLbl label,
#cbcheckedadminForm .cbSnglCtrlLbl label {
    display: inline-block !important;
    width: calc(100% - 30px) !important;
    vertical-align: top !important;
}

/* --- DESKTOP STYLES (768px and up) --- */
@media (min-width: 768px) {
    .cbLoginForm {
        max-width: 420px !important;
        margin: 60px auto !important;
        padding: 40px !important;
    }
    .cbRegistration,
    .com_comprofiler form,
    #cbcheckedadminForm {
        max-width: 650px !important;
        margin: 50px auto !important;
        padding: 40px !important;
    }

    .com_comprofiler label,
    #cbcheckedadminForm label,
    .cb_template_default label,
    .com_comprofiler .cb_form_line > label:first-child,
    #cbcheckedadminForm .cb_form_line > label:first-child,
    .com_comprofiler .control-label,
    #cbcheckedadminForm .control-label {
        display: inline-block !important;
        width: 180px !important;
        min-width: 180px !important;
        margin-right: 15px !important;
        text-align: left !important;
        vertical-align: top !important;
        padding-top: 5px !important;
        white-space: nowrap !important;
    }

    .com_comprofiler input[type="text"],
    .com_comprofiler input[type="password"],
    .com_comprofiler input[type="email"],
    #cbcheckedadminForm input[type="text"],
    #cbcheckedadminForm input[type="password"],
    #cbcheckedadminForm input[type="email"],
    .com_comprofiler select,
    #cbcheckedadminForm select,
    .com_comprofiler textarea,
    #cbcheckedadminForm textarea {
        width: 320px !important;
        max-width: 320px !important;
        display: inline-block !important;
    }

    .com_comprofiler .cbFieldIcons .cbFieldHint,
    #cbcheckedadminForm .cbFieldIcons .cbFieldHint,
    .com_comprofiler .cbValidationError,
    #cbcheckedadminForm .cbValidationError,
    .com_comprofiler .cbCaptcha,
    #cbcheckedadminForm .cbCaptcha {
        margin-left: 200px !important;
    }
}

/* --- TABLET STYLES (481px to 767px) --- */
@media (min-width: 481px) and (max-width: 767px) {
    .cbLoginForm {
        max-width: 420px !important;
        width: 90% !important;
        margin: 30px auto !important;
        padding: 25px !important;
    }
    .cbRegistration,
    .com_comprofiler form,
    #cbcheckedadminForm {
        max-width: 500px !important;
        width: 90% !important;
        margin: 30px auto !important;
        padding: 25px !important;
    }

    .com_comprofiler label,
    #cbcheckedadminForm label,
    .com_comprofiler .cb_form_line > label:first-child,
    #cbcheckedadminForm .cb_form_line > label:first-child,
    .com_comprofiler .control-label,
    #cbcheckedadminForm .control-label {
        width: 140px !important;
        min-width: 140px !important;
        margin-right: 10px !important;
        white-space: nowrap !important;
        display: inline-block !important;
        vertical-align: top !important;
    }

    .com_comprofiler input[type="text"],
    .com_comprofiler input[type="password"],
    .com_comprofiler input[type="email"],
    #cbcheckedadminForm input[type="text"],
    #cbcheckedadminForm input[type="password"],
    #cbcheckedadminForm input[type="email"],
    .com_comprofiler select,
    #cbcheckedadminForm select {
        width: 250px !important;
        max-width: 100% !important;
    }
}

/* --- MOBILE STYLES (480px and below) --- */
@media (max-width: 480px) {
    /* CB Login & Registration Form */
    .cbLoginForm,
    .cbRegistration,
    .com_comprofiler form,
    #cbcheckedadminForm {
        width: 95% !important;
        margin: 20px auto !important;
        padding: 20px !important;
    }

    .com_comprofiler label,
    #cbcheckedadminForm label,
    .com_comprofiler .cb_form_line > label:first-child,
    #cbcheckedadminForm .cb_form_line > label:first-child,
    .com_comprofiler .control-label,
    #cbcheckedadminForm .control-label {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        margin-bottom: 5px !important;
        white-space: normal !important;
        padding-top: 0 !important;
    }

    .com_comprofiler input[type="text"],
    .com_comprofiler input[type="password"],
    .com_comprofiler input[type="email"],
    #cbcheckedadminForm input[type="text"],
    #cbcheckedadminForm input[type="password"],
    #cbcheckedadminForm input[type="email"],
    .com_comprofiler select,
    #cbcheckedadminForm select,
    .com_comprofiler textarea,
    #cbcheckedadminForm textarea {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        box-sizing: border-box !important;
    }

    .com_comprofiler .cbFieldIcons .cbFieldHint,
    #cbcheckedadminForm .cbFieldIcons .cbFieldHint,
    .com_o_comprofiler .cbValidationError,
    #cbcheckedadminForm .cbValidationError,
    .com_comprofiler .cbCaptcha,
    #cbcheckedadminForm .cbCaptcha {
        margin-left: 0 !important;
        margin-top: 5px !important;
        width: 100% !important;
    }

    .com_comprofiler input[type="submit"],
    .com_comprofiler button[type="submit"],
    #cbcheckedadminForm input[type="submit"],
    #cbcheckedadminForm button[type="submit"] {
        display: block !important;
        margin: 15px auto !important;
    }
}

/* ==========================================================================
   4. Miscellaneous Styles
   ========================================================================== */

/* Hides repeat exception fields in event components */
.ev_repeatexception {
    display: none !important;
}

/* Fix Remember Me checkbox from taking full width */
.form-group input[type="checkbox"] {
    width: 1em !important;
    max-width: 1em !important;
}

/* Fix checkbox positioning */
.form-check .form-check-input[type="checkbox"] {
    float: none !important;
    margin-left: 0 !important;
    margin-right: 8px !important;
    position: relative !important;
}

/* ==========================================================================
   5. RSForm! Pro Integration Styles - Norfolk Freemasons Registration Form
   ========================================================================== */

/* Enhanced RSForm! Pro Styling for Norfolk Freemasons Registration Form */
/* Force center the RSForm with higher specificity */
.com_rsform .formResponsive {
    max-width: 1200px !important;
    margin: 2rem auto !important;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 27, 76, 0.1);
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    width: 90% !important;
    display: block !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    float: none !important;
}

/* Reset any grid or flex positioning on the parent container */
.com_rsform .grid-child.container-component,
.com_rsform .container-component {
    display: block !important;
    text-align: center !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 2rem 1rem !important;
}

/* Ensure the form itself is inline-block for centering */
.com_rsform .container-component > main {
    display: inline-block !important;
    text-align: left !important;
    width: auto !important;
}

/* Form title */
.formResponsive h2 {
    color: var(--template-special-color, #001B4C);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.2rem;
    font-weight: 600;
    position: relative;
}

.formResponsive h2::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #001B4C, #4A90E2);
    margin: 1rem auto;
    border-radius: 2px;
}

/* Two-column layout enhancement */
.formContainer.formHorizontal .formRow {
    display: flex;
    gap: 3rem;
    margin-bottom: 2rem;
}

.formSpan6 {
    flex: 1;
    min-width: 0;
}

/* Field grouping with subtle borders */
.formSpan6:first-child {
    border-right: 2px solid #f0f4fb;
    padding-right: 2rem;
}

/* Individual field blocks */
.rsform-block {
    margin-bottom: 2rem;
    transition: transform 0.2s ease;
}

.rsform-block:hover {
    transform: translateY(-2px);
}

/* Labels */
.formControlLabel {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.formRequired {
    color: #e74c3c;
    margin-left: 4px;
}

/* Input fields */
.rsform-input-box,
.rsform-password-box,
.rsform-select-box {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
    box-sizing: border-box;
}

.rsform-input-box:focus,
.rsform-password-box:focus,
.rsform-select-box:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    transform: scale(1.02);
}

/* Multi-select styling */
select[multiple] {
    min-height: 120px;
    padding: 8px;
}

select[multiple] option {
    padding: 4px 8px;
    border-radius: 4px;
    margin: 1px 0;
}

select[multiple] option:checked {
    background: linear-gradient(135deg, #4A90E2, #357ABD);
    color: white;
}

/* Submit button */
.rsform-submit-button {
    background: linear-gradient(135deg, #001B4C, #4A90E2);
    color: white;
    border: none;
    padding: 16px 48px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 27, 76, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    min-width: 200px;
}

.rsform-submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 27, 76, 0.4);
    background: linear-gradient(135deg, #002654, #5ba0f2);
}

.rsform-submit-button:active {
    transform: translateY(0);
}

/* Form descriptions */
.formDescription {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
    line-height: 1.4;
    font-style: italic;
}

/* Validation messages */
.formValidation {
    margin-top: 0.5rem;
}

.formNoError {
    display: none;
}

.formRed {
    color: #e74c3c;
    background: #fdf2f2;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #e74c3c;
    margin-bottom: 1.5rem;
}

/* Section header styling */
.form-section-header {
    background: #f0f4fb;
    padding: 0.75rem 1rem;
    margin: 0 0 1.5rem 0;
    border-left: 4px solid #001B4C;
    font-weight: 600;
    color: #001B4C;
    font-size: 1rem;
    border-radius: 4px;
}

/* Hides the input box with the ID 'name' */
#name {
    display: none !important;
}

/* Hides the label associated with the 'name' input */
label[for="name"] {
    display: none !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .formContainer.formHorizontal .formRow {
        flex-direction: column;
        gap: 0;
    }
    
    .formSpan6:first-child {
        border-right: none;
        border-bottom: 2px solid #f0f4fb;
        padding-right: 0;
        padding-bottom: 2rem;
        margin-bottom: 2rem;
    }
    
    .com_rsform .formResponsive {
        padding: 1.5rem !important;
        margin: 1rem auto !important;
        width: 95% !important;
    }
    
    .formResponsive h2 {
        font-size: 1.8rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .com_rsform .formResponsive {
        width: 98% !important;
        margin: 0.5rem auto !important;
        padding: 1rem !important;
    }
}

/* Enhanced focus states for accessibility */
.rsform-input-box:focus-visible,
.rsform-password-box:focus-visible,
.rsform-select-box:focus-visible,
.rsform-submit-button:focus-visible {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

.formBody {
    position: relative;
}

/* ==========================================================================
   6. HEADER PROTECTION - Ensure site header stays white
   ========================================================================== */

/* Ensure ONLY the site header background stays white - very specific selectors */
body > .site-grid > .container-header,
body > header.container-header,
.navbar.container-header {
    background: #ffffff !important;
}

/* ==========================================================================
   7. ENHANCED CB LOGIN FORM STYLES - Norfolk Freemasons Theme
   ========================================================================== */

/* CB Login Form Container Enhancement - Only target CB Login */
.cb_template .cbLoginForm,
div.cbLoginForm,
.mod-cblogin .cbLoginForm {
    max-width: 420px !important;
    margin: 2rem auto !important;
    background: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 27, 76, 0.1) !important;
    padding: 2rem !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
}

/* CB Login Input Fields - Only target CB Login inputs */
.cbLoginForm input[type="text"]:not(.rsform-input-box),
.cbLoginForm input[type="password"]:not(.rsform-password-box),
.cbLoginForm input[type="email"]:not(.rsform-input-box),
.cbLoginForm .form-control:not(.rsform-input-box) {
    width: 100% !important;
    padding: 12px 16px !important;
    padding-right: 3rem !important;
    border: 2px solid #e1e8ed !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    transition: all 0.3s ease !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
}

/* CB Login Input Focus - Only target CB Login inputs */
.cbLoginForm input[type="text"]:not(.rsform-input-box):focus,
.cbLoginForm input[type="password"]:not(.rsform-password-box):focus,
.cbLoginForm input[type="email"]:not(.rsform-input-box):focus,
.cbLoginForm .form-control:not(.rsform-input-box):focus {
    outline: none !important;
    border-color: #4A90E2 !important;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1) !important;
    transform: scale(1.02) !important;
}

/* CB Login Button - Only target CB Login buttons */
.cbLoginForm .btn:not(.rsform-submit-button),
.cbLoginForm input[type="submit"]:not(.rsform-submit-button),
.cbLoginForm button[type="submit"]:not(.rsform-submit-button),
.cbLoginForm .mod-login__submit .btn:not(.rsform-submit-button) {
    background: linear-gradient(135deg, #001B4C, #4A90E2) !important;
    color: white !important;
    border: none !important;
    padding: 14px 32px !important;
    border-radius: 25px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(0, 27, 76, 0.3) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0.5rem 0 !important;
}

.cbLoginForm .btn:not(.rsform-submit-button):hover,
.cbLoginForm input[type="submit"]:not(.rsform-submit-button):hover,
.cbLoginForm button[type="submit"]:not(.rsform-submit-button):hover,
.cbLoginForm .mod-login__submit .btn:not(.rsform-submit-button):hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(0, 27, 76, 0.4) !important;
    background: linear-gradient(135deg, #002654, #5ba0f2) !important;
}

/* CB Login Links - Only target CB Login links */
.cbLoginForm ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 1.5rem 0 0 0 !important;
    text-align: center !important;
}

.cbLoginForm ul li {
    margin: 0.75rem 0 !important;
    padding: 0 !important;
}

.cbLoginForm a,
.cbLoginForm .cbLoginLink {
    color: #4A90E2 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 0.95rem !important;
    transition: color 0.3s ease !important;
    display: inline-block !important;
    position: relative !important;
}

.cbLoginForm a:hover,
.cbLoginForm .cbLoginLink:hover {
    color: #001B4C !important;
    text-decoration: underline !important;
}

/* Special styling for Registration link */
.cbLoginForm ul li:last-child a,
.cbLoginForm .cbLoginLink[href*="register"],
.cbLoginForm .cbLoginLink[href*="rsform"] {
    background: linear-gradient(135deg, #f8f9fa, #e3f2fd) !important;
    color: #001B4C !important;
    padding: 10px 20px !important;
    border-radius: 20px !important;
    border: 2px solid #4A90E2 !important;
    font-weight: 600 !important;
    margin-top: 10px !important;
    transition: all 0.3s ease !important;
}

.cbLoginForm ul li:last-child a:hover,
.cbLoginForm .cbLoginLink[href*="register"]:hover,
.cbLoginForm .cbLoginLink[href*="rsform"]:hover {
    background: linear-gradient(135deg, #4A90E2, #001B4C) !important;
    color: white !important;
    text-decoration: none !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 27, 76, 0.2) !important;
}
a.menu-item-colour {
  color: #224FAA;
}

/* CB Login Form Input Groups */
.cbLoginForm .input-group {
    position: relative !important;
    margin-bottom: 1.5rem !important;
}

.cbLoginForm .input-group .input-