* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --light-bg: #f3f4f6;
    --border-color: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== LOGIN CONTAINER ===== */
.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* ===== REGISTER CONTAINER ===== */
.register-container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* ===== LOGIN CARD ===== */
.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
}

/* ===== REGISTER CARD ===== */
.register-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== LOGIN HEADER ===== */
.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 25px 20px;
    text-align: center;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
    margin: 0 0 10px 0;
}

.login-header p {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 500;
    margin: 0;
}

/* ===== REGISTER HEADER ===== */
.register-header {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.register-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
    margin: 0 0 10px 0;
}

.register-header p {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 500;
    margin: 0;
}

/* ===== USER INFO HEADER ===== */
.user-info-header {
    background: var(--light-bg);
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.user-role {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

/* ===== FORM CONTAINER ===== */
.login-form {
    padding: 30px 30px;
}

.register-form {
    padding: 25px 25px;
}

/* ===== ROLE SELECTION ===== */
.role-selection {
    padding: 15px 25px;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.role-selection label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.role-select {
    width: 100%;
    padding: 10px 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.role-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ===== FORM SECTION (FIELDSETS) ===== */
.form-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border: none;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section legend {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    padding: 0;
}

/* ===== FORM ROW (TWO COLUMN LAYOUT) ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 10px;
}

/* ===== FORM GROUP ===== */
/* .form-group {
    margin-bottom: 25px;
} */

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    text-transform: capitalize;
}

.form-group label .required {
    color: var(--danger-color);
    font-weight: 700;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

/* ===== PASSWORD STRENGTH INDICATOR ===== */
.password-strength {
    margin-top: 6px;
    height: 4px;
    border-radius: 4px;
    background: var(--border-color);
    overflow: hidden;
}

.password-strength.weak::after {
    content: '';
    display: block;
    width: 33%;
    height: 100%;
    background: var(--danger-color);
    transition: width 0.3s ease;
}

.password-strength.fair::after {
    content: '';
    display: block;
    width: 66%;
    height: 100%;
    background: var(--warning-color);
    transition: width 0.3s ease;
}

.password-strength.strong::after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: var(--success-color);
    transition: width 0.3s ease;
}

/* ===== PASSWORD WRAPPER ===== */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    flex: 1;
    padding-right: 45px !important; /* Make room for the button */
}

.toggle-password {
    position: absolute;
    right: 5px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    z-index: 100;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.toggle-password:focus {
    outline: none;
}

.toggle-password .eye-icon {
    pointer-events: none; /* Icon shouldn't capture clicks */
}

/* ===== ERROR TEXT ===== */
.error-text {
    display: block;
    color: var(--danger-color);
    font-size: 12px;
    margin-top: 6px;
    font-weight: 500;
}

/* ===== REMEMBER SECTION ===== */
.remember-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 25px;
}

.remember-section input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.remember-label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    margin: 0;
    font-weight: 500;
}

/* ===== SUBMIT BUTTON ===== */
.btn-login {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 25px;
}

.btn-register {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 25px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-register:active {
    transform: translateY(0);
}

.btn-register:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-text {
    flex: 1;
}

/* ===== SPINNER ===== */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner.hidden {
    display: none;
}

/* ===== LOGIN FOOTER ===== */
.login-footer {
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 10px 0;
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.login-footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* ===== REGISTER FOOTER ===== */
.register-footer {
    text-align: center;
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
}

.register-footer p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.register-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.register-footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* ===== TERMS SECTION ===== */
.terms-section {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 25px;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 8px;
}

.terms-section input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.terms-label {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    margin: 0;
    flex: 1;
}

.terms-label a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

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

/* ===== ALERT CONTAINER ===== */
#alertContainer {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 15px;
    animation: slideDown 0.3s ease;
    border-left: 4px solid;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left-color: var(--success-color);
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-left-color: var(--danger-color);
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left-color: var(--warning-color);
}

.alert-info {
    background-color: #cffafe;
    color: #164e63;
    border-left-color: #0891b2;
}

.alert-close {
    float: right;
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* ===== BACKGROUND DECORATION ===== */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.shape-1 {
    width: 200px;
    height: 200px;
    top: -50px;
    right: -50px;
    animation: float 6s ease-in-out infinite;
}

.shape-2 {
    width: 300px;
    height: 300px;
    bottom: -100px;
    left: -100px;
    animation: float 8s ease-in-out infinite reverse;
}

.shape-3 {
    width: 150px;
    height: 150px;
    bottom: 20%;
    right: 10%;
    animation: float 7s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(20px);
    }
}

/* ===== ROLE INFO ===== */
.role-info {
    background: white;
    border-radius: 12px;
    padding: 40px;
    margin: 20px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s ease-out;
    max-width: 600px;
    margin: 20px auto;
}

.role-info h2 {
    color: var(--success-color);
    margin-bottom: 20px;
    text-align: center;
}

.role-info.hidden {
    display: none;
}

#roleDetails {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

#roleDetails p {
    margin: 8px 0;
}

#roleDetails strong {
    color: var(--primary-color);
}

.btn-continue {
    width: 100%;
    padding: 12px 24px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-continue:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .login-container {
        max-width: 100%;
    }

    .register-container {
        max-width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .login-header {
        padding: 30px 20px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .register-header {
        padding: 30px 20px;
    }

    .register-header h1 {
        font-size: 24px;
    }

    .login-form {
        padding: 30px 20px;
    }

    .register-form {
        padding: 30px 20px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .login-footer {
        padding-top: 15px;
    }

    .login-footer p {
        margin: 8px 0;
    }

    .register-footer {
        padding: 15px 20px;
    }

    .register-footer p {
        margin: 0;
    }

    .shape-1 {
        width: 150px;
        height: 150px;
    }

    .shape-2 {
        width: 200px;
        height: 200px;
    }

    .shape-3 {
        width: 100px;
        height: 100px;
    }

    .role-selection {
        padding: 15px 20px;
    }

    .form-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 10px;
    }

    .register-container {
        padding: 10px;
    }

    .register-card {
        border-radius: 8px;
        max-height: 85vh;
    }

    .login-header {
        padding: 25px 15px;
    }

    .login-header h1 {
        font-size: 20px;
        margin-bottom: 5px;
    }

    .login-header p {
        font-size: 12px;
    }

    .register-header {
        padding: 25px 15px;
    }

    .register-header h1 {
        font-size: 20px;
        margin-bottom: 5px;
    }

    .register-header p {
        font-size: 12px;
    }

    .login-form {
        padding: 25px 15px;
    }

    .register-form {
        padding: 25px 15px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select {
        padding: 10px 12px;
        font-size: 14px;
    }

    .btn-login,
    .btn-register {
        padding: 10px 20px;
        font-size: 14px;
    }

    .login-footer p {
        font-size: 12px;
        margin: 6px 0;
    }

    .register-footer p {
        font-size: 12px;
    }

    .role-selection {
        padding: 12px 15px;
    }

    .role-select {
        padding: 8px 12px;
        font-size: 13px;
    }

    .form-section {
        margin-bottom: 15px;
        padding-bottom: 12px;
    }

    .form-section legend {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .terms-section {
        padding: 12px;
        margin-bottom: 20px;
    }

    .terms-label {
        font-size: 12px;
    }
}

/* ===== FORM VALIDATION STATES ===== */
.form-group input.is-invalid {
    border-color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.05);
}

.form-group input.is-valid {
    border-color: var(--success-color);
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode detection removed to ensure consistent light theme across all devices */
