/* css/common-form.css */

/* ==========================================================================
   Form Container & Layout
   ========================================================================== */

/* Main Form Wrapper - Base Style */
.custom-form-container-base {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 60px 50px 45px 50px;
    border: 1px solid #ddd;
    border-radius: 28px;
    background-color: #F8F7F7;
    box-sizing: border-box;
    position: relative;
    transition: box-shadow 0.5s ease-in-out, border-color 0.5s ease-in-out;
}

/* --- LOGIN SPECIFIC OVERRIDES --- */
/* Matches original custom-login.css width */
.custom-form-container-base.login-container {
    max-width: 346px;
}

/* Login specific footer links alignment */
.login-container .form-footer-links {
    text-align: left;
    margin-top: 12px;
    margin-bottom: 0;
}

/* ==========================================================================
   Floating Label Group (The Complex Logic)
   ========================================================================== */

.floating-label-group {
    position: relative;
    margin-bottom: 20px;
}

/* Input Fields */
.floating-label-group input[type="text"],
.floating-label-group input[type="email"],
.floating-label-group input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 12px; /* Standard padding */
    height: 48px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.5;
    background-color: #fff;
    color: #333;
    transition: box-shadow 0.15s ease-in-out,
                border-color 0.15s ease-in-out,
                outline 0.15s ease-in-out,
                background-color 0.15s ease-in-out;
    outline: 1px solid transparent;
    outline-offset: 0px;
    position: relative;
    z-index: 0;
}

/* Label Positioning - Restored Exact Values */
.floating-label-group label {
    position: absolute;
    left: 13px;
    top: 13px;
    font-size: 16px;
    font-weight: 400;
    color: #757575;
    pointer-events: none;
    transform-origin: left top;
    transition: transform 0.2s ease-out, color 0.15s ease-out, font-weight 0.2s ease-out;
    background-color: transparent;
    
    /* Exact padding/line-height from original to center text vertically */
    padding: 2px 7px 0px 7px;
    line-height: 1;
    z-index: 1;
    
    will-change: transform, color, font-weight;
    white-space: nowrap;
}

/* 
   Label Background "Cutout" Mask 
   This creates the effect of the border appearing 'cut' behind the text
*/
.floating-label-group label::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-color: #fff; /* Matches Input Background */
    
    /* The Magic Mask Gradient */
    -webkit-mask-image:
        linear-gradient(to bottom, transparent 0px, black 8px, black calc(100% - 8px), transparent 100%),
        linear-gradient(to right, transparent 0px, black 7px, black calc(100% - 7px), transparent 100%);
    mask-image:
        linear-gradient(to bottom, transparent 0px, black 8px, black calc(100% - 8px), transparent 100%),
        linear-gradient(to right, transparent 0px, black 7px, black calc(100% - 7px), transparent 100%);
    
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}

/* --- ACTIVE STATES --- */

/* 1. Floated State */
.floating-label-group.label-is-floated label {
    transform: translate(-3px, -22px) scale(0.875); /* Exact scale from original */
    font-weight: 700;
    color: #9e9e9e;
    z-index: 2;
}

/* 2. Focus State (Purple) */
/* Note: Using !important to ensure core variables override any theme defaults */
.floating-label-group input:focus ~ label {
    color: var(--trb-focus-color) !important;
}

/* Autofill Fix (Prevents yellow background) */
.floating-label-group input:-webkit-autofill,
.floating-label-group input:-webkit-autofill:hover, 
.floating-label-group input:-webkit-autofill:focus, 
.floating-label-group input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #333 !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* ==========================================================================
   Buttons & Links
   ========================================================================== */

.button-primary-action {
    width: 100%;
    padding: 16px;
    margin-top: 10px;
    margin-bottom: 10px;
    background-color: var(--trb-brand-color); /* #b05cfd */
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: center;
    display: inline-block;
    line-height: normal;
}

.button-primary-action:hover:not(:disabled) {
    background-color: var(--trb-brand-color-hover); /* #8341bf */
}

.button-primary-action:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 
   Footer Links (Lost Password)
   EXACT COPY of original .form-field-small-text a
*/
.form-footer-links {
    font-size: 14px;
    color: #555;
    /* Default margins, overriden by .login-container specific rules below */
    margin-top: 15px; 
    text-align: center; 
}

/* Specific overrides for the Login Context to match Daluna exactly */
.login-container .form-footer-links {
    text-align: left;    /* Aligned left */
    margin-top: 12px;    /* 12px top spacing */
    margin-bottom: 0;
}

.form-footer-links a {
    color: #007bff; /* Blue - Exact match to original */
    text-decoration: underline;
    cursor: pointer;
}

.form-footer-links a:hover {
    text-decoration: none;
}