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

:root {
    /* Kenyan Judiciary Inspired Palette */
    --jud-green: #0B3D2C;
    --jud-green-light: #155A43;
    --jud-gold: #C6A254;
    --jud-gold-light: #DFB863;
    --bg-color: #F8F9FA;
    --surface: #FFFFFF;
    --text-main: #2C3E50;
    --text-muted: #7F8C8D;
    --danger: #E74C3C;
    --success: #27AE60;
    --border: #EAEAEA;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    overflow: hidden; /* Prevents scrolling on desktop */
}

/* ── EDGE-TO-EDGE LAYOUT WRAPPER ── */
.cfts-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* ── BRANDING PANEL (LEFT) ── */
.cfts-brand {
    flex: 0 0 45%; /* Takes exactly 45% of the screen */
    background: linear-gradient(135deg, var(--jud-green) 0%, var(--jud-green-light) 100%);
    position: relative;
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #FFFFFF;
    text-align: center;
    overflow: hidden;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    z-index: 2; /* Keeps shadow above the right panel */
}

/* Geometric background pattern for authority */
.cfts-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 20% 80%, rgba(198, 162, 84, 0.1) 0%, transparent 40%),
                      radial-gradient(circle at 80% 20%, rgba(198, 162, 84, 0.1) 0%, transparent 40%);
    pointer-events: none;
}

.brand-content {
    position: relative;
    z-index: 2;
}

.brand-logo-container {
    margin-bottom: 25px;
}

.brand-logo {
    height: 110px;
    width: auto;
    object-fit: contain;
}

/* Fallback icon if logo image is missing */
.fallback-icon {
    font-size: 65px;
    color: var(--jud-gold);
    display: none; 
}
.brand-logo[style*="display: none"] + .fallback-icon {
    display: inline-block;
}

.brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 38px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 15px;
}

.brand-divider {
    width: 60px;
    height: 3px;
    background-color: var(--jud-gold);
    margin: 0 auto 15px auto;
    border-radius: 2px;
}

.brand-subtitle {
    font-size: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    margin-bottom: 40px;
}

.brand-features {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.feature {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(198, 162, 84, 0.3);
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
}

.feature i {
    color: var(--jud-gold);
}

.brand-footer {
    position: absolute;
    bottom: 25px;
    left: 0;
    right: 0;
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    text-align: center;
}

/* ── LOGIN PANEL AREA (RIGHT) ── */
.cfts-login {
    flex: 1; /* Takes the remaining 55% */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    
    /* Subtle dot-matrix pattern to eliminate plain white space */
    background-color: #FDFDFD;
    background-image: radial-gradient(#D5D8DC 1px, transparent 1px);
    background-size: 20px 20px;
}

/* ── THE ELEVATED FORM CONTAINER ── */
.login-inner {
    width: 100%;
    max-width: 480px; /* Constrains the inputs from stretching too far */
    background: var(--surface);
    padding: 50px;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0,0,0,0.05);
}

.login-header {
    margin-bottom: 35px;
}

.secure-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--jud-green);
    background: rgba(11, 61, 44, 0.08);
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 15px;
}

.login-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 15px;
}

/* ── ALERTS ── */
.alert {
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.alert-danger {
    background-color: #FDEDED;
    color: var(--danger);
    border: 1px solid #FAD1D1;
}

.alert-success {
    background-color: #EDF7F1;
    color: var(--success);
    border: 1px solid #D2EADC;
}

/* ── FORM ELEMENTS ── */
.form-group {
    margin-bottom: 22px;
}

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

.input-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: #A0AAB5;
    font-size: 16px;
}

.input-icon-wrap input {
    width: 100%;
    padding: 14px 16px 14px 45px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text-main);
    background-color: #FCFCFC;
    transition: var(--transition);
}

.input-icon-wrap input:focus {
    outline: none;
    border-color: var(--jud-green);
    background-color: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(11, 61, 44, 0.08);
}

.input-icon-wrap input:focus + .input-icon,
.input-icon-wrap input:focus ~ .input-icon {
    color: var(--jud-green);
}

.toggle-password {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: #A0AAB5;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    transition: var(--transition);
}

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

/* ── BUTTONS & ACTIONS ── */
.form-actions {
    margin-top: 30px;
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    position: relative;
}

.btn-primary {
    background-color: var(--jud-green);
    color: #FFFFFF;
}

.btn-primary:hover {
    background-color: var(--jud-green-light);
    box-shadow: 0 4px 12px rgba(11, 61, 44, 0.2);
}

.form-footer {
    margin-top: 20px;
    text-align: center;
}

.forgot-link {
    color: var(--text-muted);
    font-size: 14px;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.forgot-link:hover {
    color: var(--jud-green);
    text-decoration: underline;
}

/* ── LOADING STATE ── */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    position: absolute;
}

.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading .spinner {
    display: block;
}

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

/* ── SECURITY NOTICE ── */
.security-notice {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
}

.security-notice i {
    color: var(--danger);
    font-size: 20px;
    margin-top: 2px;
}

.security-notice p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.security-notice strong {
    color: var(--text-main);
}

/* ── RESPONSIVE DESIGN (MOBILE STACK) ── */
@media (max-width: 992px) {
    body {
        overflow-y: auto; /* Allow scrolling on mobile */
    }
    
    .cfts-wrapper {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .cfts-brand {
        flex: none;
        padding: 50px 30px;
    }

    .brand-features {
        display: none; /* Hidden on mobile to save space */
    }

    .brand-footer {
        position: relative;
        bottom: 0;
        margin-top: 30px;
    }
    
    .cfts-login {
        flex: none;
        padding: 40px 20px;
    }
    
    .login-inner {
        padding: 40px 30px;
    }
}