@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-bg: #f4f7f6;
    --primary-gradient: linear-gradient(135deg, #f4f7f6 0%, #e9ecef 100%);
    --accent-gold: #FFD700;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    --input-border: #dfe6e9;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body,
html {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    overflow: hidden;
}

#login-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    background-size: cover;
    background-position: center;
    z-index: -1;
}

/* Repeating Pattern Overlay */
#login-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='30'%3E%3Ctext x='0' y='12' fill='rgba(0,0,0,0.15)' font-size='10' font-family='Arial'%3EJeevass CMI Central School, Aluva%3C/text%3E%3Ctext x='40' y='27' fill='rgba(0,0,0,0.15)' font-size='10' font-family='Arial'%3EJeevass CMI Central School, Aluva%3C/text%3E%3C/svg%3E");
    background-repeat: repeat;
    opacity: 1;
    pointer-events: none;
}

#login-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.05) 100%);
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.2) 100%);
}

.portal-selection {
    text-align: center;
    max-width: 900px;
    width: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.institution-header {
    margin-bottom: 50px;
    color: white;
}

.institution-logo {
    width: 130px;
    height: 130px;
    background: transparent;
    border-radius: 24px;
    padding: 0;
    margin-bottom: 24px;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.portal-title {
    font-size: 3.5rem;
    font-weight: 800;
    color: #000;
    margin-bottom: 20px;
    letter-spacing: -1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#inst-tagline {
    font-size: 1.1rem;
    font-weight: 400;
    color: #000;
}

.portal-buttons {
    display: flex;
    gap: 32px;
    justify-content: center;
    margin-top: 40px;
}

.portal-btn {
    flex: 1;
    max-width: 320px;
    padding: 48px 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    isolation: isolate;
}

.portal-btn span {
    font-size: 1.4rem;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: #FFD700;
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
    color: #000;
}

u {
    text-decoration-color: #FFD700;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    color: #000;
}

.portal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.portal-btn i {
    font-size: 3.5rem;
    color: #000;
}

.portal-btn span {
    font-size: 1.4rem;
    font-weight: 600;
}

/* Redesigned Login Card (Phase 2 - Matches screenshot) */
.login-card {
    background: white;
    width: 100%;
    max-width: 650px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.header-banner {
    background: white;
    padding: 24px 20px;
    text-align: center;
    border-bottom: 3px solid #ffd700;
}

.logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.card-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.institution-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #000;
}

.institution-address {
    font-size: 0.9rem;
    color: #000;
    max-width: 450px;
    margin: 0 auto 20px;
    background: transparent;
    mix-blend-mode: multiply;
    line-height: 1.4;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-tabs {
    display: flex;
    background: #f8f9fa;
    padding: 12px 20px;
    gap: 12px;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #000 !important;
    background: #FEF9E7 !important;
    /* Light Golden Yellow */
    cursor: pointer;
    transition: var(--transition);
    white-space: normal;
    text-align: center;
    line-height: 1.2;
}

.tab-btn.active {
    color: #000;
    background: #FFD700 !important;
    /* Fully Golden Yellow */
}

.tab-btn:not(.active):hover {
    background: #dee2e6;
}

.tab-content {
    padding: 30px;
    display: none;
}

.tab-content.active {
    display: block;
}

/* Form Styles */
.login-form .form-group {
    margin-bottom: 24px;
}

.login-form label {
    display: block;
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 700;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #000;
    font-size: 1.1rem;
}

.login-form input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
    transition: var(--transition);
    font-family: inherit;
}

.login-form input:focus {
    outline: none;
    border-color: #1e3c72;
    box-shadow: 0 0 0 4px rgba(30, 60, 114, 0.1);
}

.btn-submit {
    width: 100%;
    padding: 16px;
    background: #FFD700;
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(30, 60, 114, 0.3);
}

.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.05);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.btn-back:hover {
    background: rgba(0, 0, 0, 0.1);
}

.captcha-row {
    display: flex;
    gap: 16px;
    align-items: center;
}

.captcha-question {
    background: #e9ecef;
    padding: 14px;
    border-radius: 14px;
    font-weight: 700;
    flex: 1;
    text-align: center;
    font-size: 1.1rem;
    color: #000;
}

.captcha-input {
    flex: 1;
}

.message {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.95rem;
    display: none;
    line-height: 1.5;
}

.message.error {
    background: #fff5f5;
    color: #c53030;
    border-left: 4px solid #c53030;
}

.message.success {
    background: #f0fff4;
    color: #276749;
    border-left: 4px solid #276749;
}

/* Inactivity Overlay */
#inactivity-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 42, 108, 0.95);
    z-index: 9999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    backdrop-filter: blur(15px);
    text-align: center;
    padding: 40px;
}

#inactivity-overlay h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin: 20px 0;
    letter-spacing: -0.03em;
}

@media (max-width: 768px) {
    .login-wrapper {
        padding: 10px;
    }

    .portal-buttons {
        flex-direction: column;
        align-items: center;
    }

    .portal-btn {
        width: 100%;
        max-width: none;
        padding: 24px;
    }

    .portal-title {
        font-size: 1.8rem;
    }

    .institution-logo {
        width: 100px;
        height: 100px;
    }

    .login-card {
        max-width: 95vw;
    }

    .institution-name {
        font-size: 1.3rem;
    }

    .institution-address {
        font-size: 0.85rem;
        padding: 0 10px;
    }

    .login-tabs {
        padding: 8px 10px;
        gap: 6px;
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .tab-content {
        padding: 20px 15px;
    }

    .captcha-row {
        flex-direction: column;
        gap: 10px;
    }

    .captcha-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .portal-title {
        font-size: 1.5rem;
    }

    .institution-name {
        font-size: 1.1rem;
    }

    .tab-btn {
        flex: 1 1 calc(50% - 6px);
        /* Allow tabs to wrap into Two rows if needed */
        font-size: 0.8rem;
    }
}