:root {
    --primary: #054A29;
    --primary-dark: #043920;
    --primary-light: #077963;
    --accent: #B491CA;
    --accent-hover: #9d7fb0;
    --surface: #ffffff;
    --background: #F8F9FA;
    --text-main: #1F2937;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --error: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;
    --radius: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    margin: 0;
    padding: 0;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: radial-gradient(circle at top right, #eef2ff, #f3f4f6 60%, #ffffff);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 20px,
            rgba(180, 145, 202, 0.05) 20px,
            rgba(180, 145, 202, 0.05) 40px);
    z-index: 0;
    pointer-events: none;
}

/* Background Shapes */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    top: -10%;
    right: -5%;
    width: 500px;
    height: 500px;
    background: rgba(180, 145, 202, 0.15);
    animation-delay: 0s;
}

.shape-2 {
    bottom: -10%;
    left: -5%;
    width: 600px;
    height: 600px;
    background: rgba(5, 74, 41, 0.1);
    animation-delay: -5s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -50px) rotate(10deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(-5deg);
    }
}

.auth-card,
.otp-card,
.reset-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: auto;
}

.auth-card:hover,
.otp-card:hover,
.reset-card:hover {
    transform: translateY(-5px);
}

.logo-container,
.brand-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.big-logo {
    width: 150px;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.big-logo:hover {
    transform: scale(1.05);
}

.card-header,
.otp-header,
.reset-header {
    text-align: center;
    margin-bottom: 2rem;
    background: transparent;
    border: none;
    padding: 0;
}

.card-title,
.otp-header h5,
.reset-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.card-subtitle,
.otp-header p,
.reset-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.input-group-custom,
.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    font-size: 1.2rem;
    transition: color 0.2s ease;
    z-index: 10;
}

.form-control,
.input-group input {
    display: block;
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    /* Left padding for icon */
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--surface);
    background-clip: padding-box;
    border: 2px solid #F3F4F6;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Adjust padding if no icon or specific to otp */
.input-group input:not([class*="padding"]) {
    /* padding-left: 1rem; -- careful, blade files structure varies */
}

/* Revert standard form-control padding for icon usage */
.input-group-custom .form-control .input-group input {
    /* Styles are merged */
}

.form-control:focus,
.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(5, 74, 41, 0.1);
    outline: none;
    background-color: #fff;
}

.form-control:focus+.input-icon {
    color: var(--primary);
}

.form-control.has-error,
.is-invalid {
    border-color: var(--error);
    background-color: #FEF2F2;
}

.form-control.has-success {
    border-color: var(--success);
    background-color: #F0FDF4;
}

.input-feedback {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    min-height: 1.25em;
    transition: all 0.3s ease;
}

.input-feedback.error,
.invalid-feedback {
    color: var(--error);
    display: block;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.input-feedback.valid {
    color: var(--success);
}

.form-error {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    padding-left: 0.25rem;
}

.toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: var(--text-main);
}

.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
    /* Responsive wrap */
    gap: 0.5rem;
}

.form-check-input {
    width: 1.1em;
    height: 1.1em;
    margin-top: 0;
    border-color: #D1D5DB;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-label {
    color: var(--text-secondary);
    cursor: pointer;
    padding-left: 0.5rem;
}

.link-primary {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.link-primary:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Buttons */
.btn,
.btn-submit,
.btn-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(5, 74, 41, 0.2), 0 2px 4px -1px rgba(5, 74, 41, 0.1);
}

/* Specific overrides for btn-submit/reset if needed to match generic btn */
.btn-submit:hover,
.btn-reset:hover,
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(5, 74, 41, 0.3), 0 4px 6px -2px rgba(5, 74, 41, 0.15);
}

.btn-primary:active,
.btn-submit:active,
.btn-reset:active {
    transform: translateY(0);
}

.social-login-wrapper {
    margin-top: 2rem;
    position: relative;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #9CA3AF;
    font-size: 0.875rem;
    margin: 1.5rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #E5E7EB;
}

.divider::before {
    margin-right: 1rem;
}

.divider::after {
    margin-left: 1rem;
}

.btn-google {
    background-color: white;
    color: var(--text-main);
    border: 1px solid #E5E7EB;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.btn-google:hover {
    background-color: #F9FAFB;
    border-color: #D1D5DB;
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid #E5E7EB;
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--text-main);
    background-color: #F9FAFB;
}

.btn-register {
    background: linear-gradient(135deg, var(--accent) 0%, #9d7fb0 100%);
    color: white;
    margin-top: 1rem;
}

.btn-register:hover {
    filter: brightness(110%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(180, 145, 202, 0.4);
}

.register-prompt {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Animations */
.animate-fade-up,
.reset-card,
.otp-card {
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Preloader */
.preloader-overlay,
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--surface);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader-overlay.hidden,
.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Role Selection */
.role-selection-group {
    margin-bottom: 1.5rem;
}

.role-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.role-option {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.role-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.role-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    background: #ffffff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

.role-option input[type="radio"]:checked+.role-card {
    border-color: var(--primary);
    background-color: #F0FDF4;
    box-shadow: 0 4px 6px -1px rgba(5, 74, 41, 0.1);
}

.role-option:hover .role-card {
    border-color: #9CA3AF;
    transform: translateY(-2px);
}

.role-option input[type="radio"]:checked+.role-card .role-icon {
    color: var(--primary);
}

.role-option input[type="radio"]:checked+.role-card .role-title {
    color: var(--primary);
    font-weight: 700;
}

.role-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.role-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    transition: color 0.2s;
}

.checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.role-option input[type="radio"]:checked+.role-card .checkmark {
    opacity: 1;
    transform: scale(1);
}

.checkmark svg {
    width: 12px;
    height: 12px;
    color: white;
}

/* Password Strength Meter */
.password-strength-meter {
    height: 4px;
    background-color: #E5E7EB;
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    opacity: 0;
    height: 0;
}

.password-strength-meter.visible {
    opacity: 1;
    height: 4px;
    margin-top: 10px;
}

.password-strength-meter-bar {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.password-strength-text {
    font-size: 0.75rem;
    margin-top: 4px;
    color: var(--text-secondary);
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    text-align: right;
}

.password-strength-text.visible {
    opacity: 1;
    height: auto;
    margin-top: 4px;
}

.password-criteria {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.criteria-item {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

/* criteria icons */
.criteria-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    border-radius: 50%;
    background-color: #E5E7EB;
    position: relative;
    flex-shrink: 0;
}

.criteria-item.valid .criteria-icon {
    background-color: var(--success);
}

.criteria-item.valid .criteria-icon::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.criteria-item.invalid .criteria-icon {
    background-color: var(--error);
}

.criteria-item.invalid .criteria-icon::after {
    content: '✗';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

/* OTP Specific Styles */
.otp-email {
    font-weight: 700;
    color: var(--primary);
    word-break: break-all;
    font-size: 1.1rem;
    display: block;
    margin: 12px 0;
    padding: 10px;
    background: rgba(5, 74, 41, 0.05);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.otp-input-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    /* Reduced gap for mobile */
    margin-bottom: 2rem;
}

.otp-input {
    height: 60px;
    /* Responsive size */
    width: 50px;
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    transition: all 0.2s ease;
    background: white;
    padding: 0;
    /* Override form-control padding */
}

.otp-input:focus {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.otp-input.filled {
    border-color: var(--success);
    background-color: #F0FDF4;
}

.spam-note {
    background: #FFFBEB;
    border-left: 4px solid var(--warning);
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: #92400E;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.resend-link {
    text-align: center;
    margin-top: 1.5rem;
}

.resend-link a {
    color: var(--primary);
    font-weight: 700;
}

.resend-timer {
    color: var(--success);
    font-weight: 700;
}

/* Reset Password Specific */
.password-helper {
    background: #F9FAFB;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid #E5E7EB;
    text-align: center;
}

.password-helper h4 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.modern-alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    background-color: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

/* Responsive Styles - Priority for Mobile */
@media (max-width: 640px) {
    .login-wrapper {
        padding: 0;
        /* Maximize space */
    }

    .auth-card,
    .otp-card,
    .reset-card {
        padding: 1.5rem;
        border-radius: 0;
        /* Full width approach generally looks better or slightly rounded at top */
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        box-shadow: none;
        border: none;
        max-width: 100%;
        margin: 0;
    }

    .card-title,
    .otp-header h5,
    .reset-header h2 {
        font-size: 1.5rem;
        /* Smaller title */
    }

    .big-logo {
        width: 120px;
        height: auto;
    }

    .otp-input-group {
        gap: 10px;
    }

    .otp-input {
        width: 18%;
        /* Fluid width */
        height: 55px;
        font-size: 20px;
    }

    .footer-links {
        margin-bottom: 2rem;
    }
}

@media (min-width: 641px) {

    .auth-card,
    .otp-card,
    .reset-card {
        border-radius: 24px;
        min-height: auto;
    }
}