/*
 * Combined Forms CSS
 * Shared styles for registration and contact update forms
 */

/* ==========================================================================
   Base Layout & Structure
   ========================================================================== */

html {
    position: relative;
    min-height: 100%;
}

body {
    background-color: #EEEEEE;
    padding-bottom: 10px;
    margin: 0 0 45px;
}

/* ==========================================================================
   Button Focus Styles
   ========================================================================== */

.submit-button:focus,
.btn-register:focus,
.btn-submit:focus {
    outline: none;
    box-shadow: 0 0 5px rgba(66, 139, 202, 0.5);
}

/* Button with tooltip layout for registration page */
.button-with-tooltip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    width: 100%;
}

.button-with-tooltip .btn-register {
    flex: 0 0 auto;
}

.button-with-tooltip .info-tooltip {
    flex-shrink: 0;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.form-signin {
    margin: 0 auto;
    max-width: 330px;
    padding: 15px;
}

.form-signin-heading {
    font-size: 20px;
    display: block;
    color: #FFFFFF;
    border-radius: 6px;
    line-height: 2.3;
    text-align: center;
    vertical-align: middle;
    font-weight: 400;
    cursor: default;
}

/* ==========================================================================
   Footer Styles
   ========================================================================== */

.footer-container {
    vertical-align: bottom;
    position: absolute;
    left: 0;
    bottom: 0;
    height: 55px;
    width: 100%;
}

/* Footer classes */
.login-footer,
div.footer {
    font-size: 14px;
    height: auto;
    text-align: center;
}

.login-footer-warning,
div.footer-warning {
    font-size: 12px;
    height: auto;
    text-align: center;
    font-weight: bold;
}

.build-info-span {
    position: absolute;
    font-size: 10px;
    font-weight: 100;
    color: #7F7F7F;
    bottom: 0;
    left: 0;
    padding-bottom: 5px;
}

/* ==========================================================================
   Logo & Branding
   ========================================================================== */

.logo {
    margin-top: 30px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 200px;
}

.logo-container {
    width: 230px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.customer-logo-container {
    width: 350px;
    margin-left: auto;
    margin-right: auto;
    display: block;
    padding-top: 20px;
}

/* ==========================================================================
   Form Container Styles
   ========================================================================== */

/* Form containers */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #EEEEEE;
    box-sizing: border-box;
}

.form-wrapper {
    background-color: #FFFFFF;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

/* ==========================================================================
   Form Titles & Sections
   ========================================================================== */

.form-main-title {
    color: #333;
    font-size: 26px;
    font-weight: 600;
    text-align: center;
    margin-top: 0;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #337ab7; /* Default blue */
}

/* Registration form uses different blue */
.form-wrapper .form-main-title {
    border-bottom-color: #428BCA;
    margin-bottom: 40px;
}

.form-subtitle {
    color: #666;
    font-size: 18px;
    font-weight: normal;
    text-align: center;
    margin-top: -20px;
    margin-bottom: 20px;
    font-style: italic;
}

.form-section {
    margin-bottom: 40px;
}

/* Registration form uses different blue */
.form-wrapper .section-title {
    border-bottom-color: #428BCA;
}

/* ==========================================================================
   Form Fields & Inputs
   ========================================================================== */

.form-field {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-field.required .field-label:after {
    content: " *";
    color: #d9534f;
    font-weight: bold;
}

.field-label {
    display: block;
    margin-bottom: 0;
    font-weight: 500;
    color: #333;
    font-size: 16px;
    min-width: 200px;
    max-width: 200px;
    flex-shrink: 0;
    padding-top: 12px;
    text-align: right;
    box-sizing: border-box;
    word-wrap: break-word;
    line-height: 1.3;
}

.field-input-wrapper {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 215px); /* Account for larger label width + gap */
    box-sizing: border-box;
    position: relative;
    overflow: visible;
}

/* Make sure all input fields have consistent width */
.field-input-wrapper .form-control,
.field-input-wrapper .input-field {
    width: 100%;
    max-width: calc(100% - 34px); /* Reserve space for tooltip */
    box-sizing: border-box;
}

/* Position help button container */
.help-button-container {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    flex-shrink: 0;
}

/* Input field styles (both semantic and legacy) */
.form-control,
.input-field {
    width: 100%;
    max-width: calc(100% - 34px); /* Reserve space for tooltip */
    padding: 12px 15px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
    box-sizing: border-box;
}

.form-control:focus,
.input-field:focus {
    border-color: #66afe9;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}

.form-control[readonly] {
    background-color: #f5f5f5;
    opacity: 1;
}

/* Error states - Django errors and HTML5 validation */
.has-error .form-control,
.has-error .input-field {
    border-color: #dc3545;
    border-width: 2px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.has-error .form-control:focus,
.has-error .input-field:focus {
    border-color: #dc3545;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* HTML5 validation styling - only after user interaction */
.form-control:not(:focus):not(:placeholder-shown):invalid,
.input-field:not(:focus):not(:placeholder-shown):invalid {
    border-color: #dc3545;
    border-width: 2px;
}

.form-control:invalid:focus,
.input-field:invalid:focus {
    border-color: #dc3545;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* ==========================================================================
   Form Buttons
   ========================================================================== */

/* Legacy button styles */
label, .btn, .form-control {
    -moz-box-sizing: border-box;
    font-size: 16px;
    height: auto;
    padding: 10px;
    position: relative;
}

.btn {
    width: 50%;
}

.btn2 {
    width: 70%;
}

/* Submit buttons */
.submit-button,
.action-button,
.btn-register,
.btn-submit {
    min-width: 200px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    background-color: #337ab7;
    border-color: #2e6da4;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
}

/* Registration form uses different blue */
.form-wrapper .btn-register,
.form-wrapper .action-button {
    background-color: #428BCA;
    border-color: #357ebd;
}

.submit-button:hover,
.action-button:hover,
.btn-register:hover,
.btn-submit:hover {
    background-color: #286090;
    border-color: #204d74;
}

.form-wrapper .btn-register:hover,
.form-wrapper .action-button:hover {
    background-color: #3071a9;
    border-color: #285e8e;
}

.submit-button:focus,
.action-button:focus,
.btn-register:focus,
.btn-submit:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(51, 122, 183, 0.25);
}

.submit-button:active,
.action-button:active,
.btn-register:active,
.btn-submit:active {
    background-color: #204d74;
    border-color: #122b40;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}

.form-wrapper .btn-register:active,
.form-wrapper .action-button:active {
    background-color: #285e8e;
    border-color: #204d74;
}

.action-button:disabled,
.btn-register:disabled,
.btn-submit:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.65;
}

/* Primary button class (legacy) */
.btn-primary {
    color: #fff;
    background-color: #337ab7;
    border-color: #2e6da4;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
}

.btn-primary:hover {
    background-color: #286090;
    border-color: #204d74;
}

.btn-primary:active {
    background-color: #204d74;
    border-color: #122b40;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}

/* ==========================================================================
   Error Handling & Messages
   ========================================================================== */

.error-message {
    color: #d9534f;
    font-size: 12px;
    font-weight: bold;
    margin-top: 5px;
    margin-bottom: 0;
}

.help-text {
    color: #737373;
    font-size: 12px;
    margin-top: 5px;
    margin-bottom: 0;
}

.help-block {
    color: #d9534f;
    font-size: 12px;
    font-weight: bold;
    margin-top: 5px;
    margin-bottom: 0;
}

.has-error {
    color: #d9534f;
    font-size: 12px;
    font-weight: bold;
    margin-top: 5px;
    margin-bottom: 0;
}

/* Form-level errors (registration) */
.form-field.has-error:not(.required):not(.terms-field) {
    background-color: #f2dede;
    border: 1px solid #ebccd1;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    display: block !important;
}

.form-field.has-error:not(.required):not(.terms-field) .error-message {
    font-size: 14px;
    margin: 0;
    color: #a94442;
}

/* Form-level errors (contact update) */
.form-level-errors.has-error {
    background-color: #f2dede;
    border: 1px solid #ebccd1;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

.form-level-errors.has-error .error-message {
    font-size: 14px;
    margin: 0;
    color: #a94442;
}

/* ==========================================================================
   Checkboxes & Terms
   ========================================================================== */

.terms {
    font-size: 12px;
}

.terms-field {
    margin-top: 30px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 4px solid #337ab7;
    display: block !important;
}

.form-wrapper .terms-field {
    border-left-color: #428BCA;
}

.checkbox-field {
    margin-bottom: 20px;
    display: block !important;
    padding-left: 155px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 2px;
    flex-shrink: 0;
}

.checkbox-text {
    color: #555;
}

.checkbox-text a {
    color: #337ab7;
    text-decoration: none;
}

.checkbox-text a:hover {
    text-decoration: underline;
}

.form-wrapper .checkbox-text a {
    color: #428BCA;
}

/* ==========================================================================
   Help & Information Features
   ========================================================================== */

/* Help link styling */
.help-link-container {
    text-align: right;
    margin-bottom: 20px;
    font-size: 14px;
}

.help-link-container a {
    color: #337ab7;
    text-decoration: none;
}

.help-link-container a:hover {
    text-decoration: underline;
}

/* Field with help styling */
.field-with-help {
    position: relative;
    overflow: visible;
}

.field-with-help input {
    width: 100%;
    max-width: calc(100% - 34px); /* Reserve space for tooltip */
}

/* Native CSS Tooltips */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    width: 24px;
    height: 24px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 50%;
    color: #333;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    z-index: 1;
}

.info-icon {
    display: block;
    line-height: 1;
}

.info-tooltip:hover {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.info-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    border: 1px solid #333;
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 9999;
    font-size: 12px;
    font-weight: normal;
    width: 220px;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    word-wrap: break-word;
    hyphens: auto;
    white-space: normal;
}

.info-tooltip:hover::before {
    content: "";
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    z-index: 9999;
}

/* ==========================================================================
   Input Groups & Complex Controls
   ========================================================================== */

/* Input group styling for hint buttons */
.input-group {
    position: relative;
    display: flex;
    width: 100%;
}

.input-group .form-control {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-btn {
    display: flex;
}

.input-group-btn .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    min-width: auto;
    padding: 12px 15px;
}

.input-group-info-popover-button {
    font-weight: bold;
    font-size: 14px;
    border: 2px solid #000;
    border-radius: 50%;
    text-align: center;
    padding: 4px 8px 4px;
}

.input-group-info-popover-logo {
    font-weight: bold;
    color: #000;
}

span.info-button-container {
    vertical-align: top;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

div.input-parent-container {
    width: 100%;
}

/* ==========================================================================
   Submit Sections
   ========================================================================== */

.submit-section {
    text-align: center;
    margin-top: 0;
    padding-top: 30px;
    border-top: 1px solid #e5e5e5;
}

/* ==========================================================================
   Success Messages & Status Pages
   ========================================================================== */

.success-panel {
    background-color: #dff0d8;
    border: 1px solid #d6e9c6;
    border-radius: 4px;
    margin-bottom: 30px;
}

.success-header {
    background-color: #5cb85c;
    color: #fff;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px 4px 0 0;
    margin: 0;
}

.success-content {
    padding: 20px;
    color: #3c763d;
    font-size: 14px;
    line-height: 1.5;
}

.error-panel {
    background-color: #f2dede;
    border: 1px solid #ebccd1;
    border-radius: 4px;
    margin-bottom: 30px;
}

.error-header {
    background-color: #d9534f;
    color: #fff;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px 4px 0 0;
    margin: 0;
}

.error-content {
    padding: 20px;
    color: #a94442;
    font-size: 14px;
    line-height: 1.5;
}

/* General message section for status pages (logout, registration success, etc.) */
.message-section {
    text-align: center;
    padding: 40px 20px;
}

.message-panel {
    background-color: #dff0d8;
    border: 1px solid #d6e9c6;
    border-radius: 4px;
    padding: 20px;
    margin: 30px 0;
    color: #3c763d;
    font-size: 16px;
}

.message-panel p {
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.message-panel p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Button Groups & Secondary Buttons
   ========================================================================== */

.button-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    width: 100%;
}

.button-group .submit-button,
.button-group .secondary-button {
    flex: 0 0 auto;
}

.button-group .button-help {
    flex-shrink: 0;
}

.secondary-button {
    display: inline-block;
    padding: 12px 24px;
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 120px;
}

.secondary-button:hover {
    background-color: #5a6268;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.secondary-button:focus {
    outline: none;
    box-shadow: 0 0 5px rgba(108, 117, 125, 0.5);
}

.secondary-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Section titles for contact forms */
.section-title {
    color: #333;
    font-size: 20px;
    font-weight: 600;
    margin: 20px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.section-title:first-child {
    margin-top: 0;
}

/* ==========================================================================
   Button Groups with Info Tooltips
   ========================================================================== */

/* Button group styling for registration page */
.btn-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 10px 0;
}

/* Full-width button groups for registration page */
.form-wrapper .btn-group {
    width: 100%;
}

.btn-group .action-button {
    height: 45px;
    background-color: #428BCA;
    border-color: #357ebd;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
    padding: 0 24px;
    margin: 0;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #357ebd;
    min-width: 200px; /* Use the standard button min-width */
    max-width: 200px; /* Prevent buttons from growing too large */
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    line-height: 1;
}

/* Full-width buttons only for registration page */
.form-wrapper .btn-group .action-button {
    width: 88%;
    min-width: auto;
}

.btn-group .action-button:hover {
    background-color: #3071a9;
    border-color: #285e8e;
    color: #fff;
    text-decoration: none;
}

.btn-group .info-button {
    width: 43px;
    height: 43px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 0 4px 4px 0;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    border-left: none;
    cursor: help;
    position: relative;
    flex-shrink: 0;
}

.btn-group .info-button:hover {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
    text-decoration: none;
}

.btn-group .info-button:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    border: 1px solid #333;
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 9999;
    font-size: 12px;
    font-weight: normal;
    width: 220px;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    word-wrap: break-word;
    hyphens: auto;
    white-space: normal;
}

.btn-group .info-button:hover::before {
    content: "";
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    z-index: 9999;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Spacer for adding breathing room between elements */
.subtitle-spacer {
    height: 15px;
}

/* ==========================================================================
   Full-Width Button Layout
   ========================================================================== */

/* Full-width buttons - reusable class for any page that needs this layout */
.full-width-buttons .btn-group {
    width: 100%;
    margin: 15px 0;
}

.full-width-buttons .btn-group .action-button {
    flex: 1;
    width: 100%;
    max-width: none;
    text-align: center;
    min-width: auto;
}

/* ==========================================================================
   Responsive Tooltip Fixes
   ========================================================================== */

/* Fix tooltips getting cut off on medium screens */
@media (max-width: 768px) {
    .btn-group .info-button:hover::after,
    .info-tooltip:hover::after {
        width: 200px;
        max-width: calc(100vw - 40px);
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Fix tooltips getting cut off on small screens */
@media (max-width: 480px) {
    .btn-group .info-button:hover::after,
    .info-tooltip:hover::after {
        width: 180px;
        max-width: calc(100vw - 20px);
        left: auto;
        right: 0;
        transform: none;
    }
    
    .btn-group .info-button:hover::before,
    .info-tooltip:hover::before {
        left: auto;
        right: 20px;
        transform: none;
    }
    
    /* Allow button text to wrap to multiple lines on small screens */
    .btn-group .action-button {
        white-space: normal;
        word-wrap: break-word;
        hyphens: auto;
        line-height: 1.3;
        min-height: 43px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
}