/* General Styles - Material Design Inspired */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");

body {
    font-family: "Roboto", sans-serif;
    background-color: #f5f5f5; /* Material Design background color */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    color: rgba(0, 0, 0, 0.87); /* Material Design primary text color */
}

.container {
    background-color: #ffffff;
    padding: 24px;
    border-radius: 8px; /* Slightly larger radius for Material feel */
    box-shadow: 0 2px 4px -1px rgba(0,0,0,0.2), 
                0 4px 5px 0 rgba(0,0,0,0.14), 
                0 1px 10px 0 rgba(0,0,0,0.12); /* Material Design elevation (dp4) */
    width: 100%;
    max-width: 400px; /* Adjusted for a more compact Material form */
    box-sizing: border-box;
}

h2 {
    text-align: center;
    color: rgba(0, 0, 0, 0.87);
    margin-bottom: 24px;
    font-size: 20px; /* Material Design Headline 6 */
    font-weight: 500;
}

/* Form Elements - Material Design Text Fields (Filled) */
.input-group {
    margin-bottom: 24px;
    position: relative;
}

.input-group label {
    position: absolute;
    left: 16px;
    top: 18px; /* Vertically centered for 56px height field */
    font-size: 16px;
    color: rgba(0, 0, 0, 0.6); /* Hint/placeholder text color */
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left top;
}

.input-group input[type="text"],
.input-group input[type="email"],
.input-group input[type="password"] {
    width: 100%;
    height: 56px; /* Material Design text field height */
    padding: 20px 16px 6px 16px; /* Top padding for label, bottom for line */
    background-color: rgba(0, 0, 0, 0.06); /* Filled text field background */
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.42); /* Resting line */
    border-radius: 4px 4px 0 0; /* Top corners rounded */
    box-sizing: border-box;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.87);
    transition: border-bottom-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-group input[type="text"]:focus,
.input-group input[type="email"]:focus,
.input-group input[type="password"]:focus {
    outline: none;
    border-bottom: 2px solid #6200ee; /* Material primary color for active line */
    padding-bottom: 5px; /* Adjust padding for thicker border */
    background-color: rgba(0, 0, 0, 0.09);
}

/* Floating label effect */
.input-group input[type="text"]:focus + label,
.input-group input[type="email"]:focus + label,
.input-group input[type="password"]:focus + label,
.input-group input[type="text"]:not(:placeholder-shown) + label,
.input-group input[type="email"]:not(:placeholder-shown) + label,
.input-group input[type="password"]:not(:placeholder-shown) + label {
    transform: translateY(-12px) scale(0.75);
    color: #6200ee; /* Material primary color for active label */
    top: 8px; /* Adjust to position correctly when scaled */
}

/* Label color for filled, non-focused state */
.input-group input[type="text"]:not(:placeholder-shown):not(:focus) + label,
.input-group input[type="email"]:not(:placeholder-shown):not(:focus) + label,
.input-group input[type="password"]:not(:placeholder-shown):not(:focus) + label {
    color: rgba(0, 0, 0, 0.6);
}

/* Add placeholder to trigger :not(:placeholder-shown) even if empty. JS will manage this. */
/* Or use a class like .has-value if JS adds it */

.toggle-password {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    cursor: pointer;
    color: rgba(0, 0, 0, 0.54); /* Icon color */
    font-size: 14px; /* Smaller, or use an icon font */
    user-select: none;
}

/* Checkbox - Material Design */
.input-group.terms {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.input-group.terms input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.54);
    border-radius: 2px;
    margin-right: 8px;
    cursor: pointer;
    position: relative;
    outline: none;
    vertical-align: middle; /* Align with label text */
}

.input-group.terms input[type="checkbox"]:checked {
    background-color: #6200ee; /* Material primary color */
    border-color: #6200ee;
}

.input-group.terms input[type="checkbox"]:checked::before {
    content: "\2713"; /* Checkmark */
    font-size: 14px;
    color: white;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
}

.input-group.terms label {
    font-size: 14px;
    font-weight: normal;
    color: rgba(0, 0, 0, 0.87);
    position: static; /* Override absolute positioning from general label */
    transform: none; /* Override transform from general label */
}

.input-group.terms a {
    color: #6200ee;
    text-decoration: none;
    font-weight: 500;
}

.input-group.terms a:hover {
    text-decoration: underline;
}

.options {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.options a {
    color: #6200ee;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 0; /* Make it easier to tap */
}

.options a:hover {
    text-decoration: none; /* Material usually doesn't underline on hover for these links */
    background-color: rgba(98, 0, 238, 0.08); /* Light ripple/hover effect */
    border-radius: 4px;
}

/* Button - Material Design (Contained) */
.btn {
    background-color: #6200ee; /* Material primary color */
    color: white;
    padding: 0 16px;
    height: 36px; /* Material button height */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px; /* Material button text style */
    font-weight: 500;
    text-transform: uppercase; /* Material button text style */
    width: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); /* Material elevation (dp2) */
    transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 16px;
    line-height: 36px; /* Vertically center text */
}

.btn:hover {
    background-color: #5a00d0; /* Darken primary color on hover */
    box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); /* Material elevation (dp4) */
}

.btn:active {
    box-shadow: 0 6px 10px rgba(0,0,0,0.2), 0 1px 18px rgba(0,0,0,0.12); /* Material elevation (dp8) */
}

/* Social Login - Material Design (Outlined Buttons) */
.social-login {
    text-align: center;
    margin-top: 24px;
}

.social-login p {
    margin-bottom: 16px;
    color: rgba(0, 0, 0, 0.6);
    font-size: 14px;
}

.social-btn {
    height: 36px;
    padding: 0 16px;
    border: 1px solid rgba(0, 0, 0, 0.23); /* Outlined button border */
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin: 8px 4px;
    transition: background-color 0.28s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: transparent;
    text-transform: uppercase;
    line-height: 34px; /* Adjust for border */
}

.social-btn:hover {
    background-color: rgba(0, 0, 0, 0.04); /* Light hover for outlined */
}

.social-btn.google { color: #db4437; border-color: #db4437; }
.social-btn.google:hover { background-color: rgba(219, 68, 55, 0.08); }

.social-btn.facebook { color: #3b5998; border-color: #3b5998; }
.social-btn.facebook:hover { background-color: rgba(59, 89, 152, 0.08); }

.social-btn.twitter { color: #1da1f2; border-color: #1da1f2; }
.social-btn.twitter:hover { background-color: rgba(29, 161, 242, 0.08); }

.social-btn.github { color: #333; border-color: #333; }
.social-btn.github:hover { background-color: rgba(51, 51, 51, 0.08); }

/* Form Switching Links */
.form-container > p {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
}

.form-container > p a {
    color: #6200ee;
    text-decoration: none;
    font-weight: 500;
}

.form-container > p a:hover {
    text-decoration: none;
    background-color: rgba(98, 0, 238, 0.08);
    border-radius: 4px;
}

/* Password Strength Indicator - Material Themed */
.password-strength {
    margin-top: 8px;
    height: 4px; /* Thinner bar */
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.12); /* Background for the bar track */
    border-radius: 2px;
}

.strength-bar {
    height: 100%;
    width: 0;
    background-color: #6200ee; /* Default to primary color, JS will change */
    border-radius: 2px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.strength-text {
    margin-left: 0; /* Remove margin, position below or integrate differently */
    margin-top: 4px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
    display: block; /* Make it block to appear below */
}

/* Validation Feedback - Material Style */
.input-group input.invalid {
    border-bottom-color: #b00020; /* Material error color */
}
.input-group input.invalid:focus {
    border-bottom-color: #b00020; /* Material error color */
}

.input-group input.invalid + label,
.input-group input.invalid:focus + label {
    color: #b00020; /* Material error color for label */
}

.input-group input.valid {
    /* Optional: style for valid fields, Material often just uses normal state */
    /* border-bottom-color: #00c853; */
}
/* .input-group input.valid:focus { border-bottom-color: #00c853; } */
/* .input-group input.valid + label { color: #00c853; } */

.error-message {
    color: #b00020; /* Material error color */
    font-size: 12px;
    margin-top: 4px;
    padding-left: 16px; /* Align with input text */
    display: none; /* Hidden by default, JS will show */
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .container {
        margin: 16px;
        padding: 16px;
        box-shadow: none; /* Flat on small screens or less shadow */
    }

    .social-btn {
        display: block;
        width: calc(100% - 8px);
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 8px;
    }
    .social-btn:last-child {
        margin-bottom: 0;
    }
}

/* Ensure labels are correctly positioned above inputs in HTML for floating label */
/* HTML structure should be <input ...><label ...> or JS to handle if label is first */
/* The current HTML has label first, so JS needs to handle adding a class or the CSS needs to be more complex or HTML reordered */
/* For simplicity with current HTML (label first), we'll rely on JS adding a class like 'has-value' or 'is-focused' to the input-group or input */
/* OR, a simpler CSS-only approach for floating labels requires input to be before label or specific sibling selectors not always robust */

/* Let's adjust HTML slightly for better CSS-only floating labels if possible, or confirm JS handles it. */
/* Assuming HTML: <div class="input-group"><input id="field" placeholder=" "><label for="field">Label</label></div> */
/* The placeholder=" " is a common trick for :placeholder-shown to work on empty fields for floating label */

/* Adjusting toggle password position for new field height */
.input-group .toggle-password {
    top: 28px; /* (56px / 2) */
}

/* Password strength text below bar */
.input-group .password-strength + .strength-text {
    display: block;
    text-align: right;
}


