/* ==========================================================================
   स्कूल शिक्षा विभाग, मध्य प्रदेश (एजुकेशन पोर्टल 3.0) — Central Login Stylesheet
   100% Fit-to-Screen (No Scroll), Zero External CDN, 100% Offline-Ready
   ========================================================================== */

:root {
    --mp-orange-start: #ff781f;
    --mp-orange-end: #ea580c;
    --mp-purple-primary: #5944d3;
    --mp-purple-hover: #4834be;
    --mp-purple-light: #f3f0ff;
    --mp-text-dark: #1e293b;
    --mp-text-muted: #64748b;
    --mp-border-color: #e2e8f0;
    --mp-input-bg: #f8fafc;
    --mp-error-red: #dc2626;
    --mp-error-bg: #fef2f2;
    --system-font-stack: "Segoe UI", "Nirmala UI", "Mangal", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── Base / Full Height Fit-to-Screen ───────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body.portal-body {
    font-family: var(--system-font-stack);
    background-color: #f1f5f9;
    color: var(--mp-text-dark);
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

/* ── Compact Top Header Banner (सॉलिड केसरिया/ऑरेंज) ──────────────────────── */
.mp-header-banner {
    background: linear-gradient(135deg, var(--mp-orange-start) 0%, var(--mp-orange-end) 100%);
    color: #ffffff;
    padding: 0.55rem 1rem 0.45rem 1rem;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.2);
    border-bottom: 2px solid #c2410c;
    flex-shrink: 0;
    text-align: center;
}

.mp-header-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-bottom: 0.1rem;
    color: #ffffff;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.mp-header-subtitle {
    font-size: 1rem;
    font-style: italic;
    font-weight: 600;
    color: #1e1b18;
    margin-bottom: 0;
    line-height: 1.2;
    letter-spacing: 0.3px;
}

/* ── Center Main Content Wrapper (Fit-to-Screen) ───────────────────────── */
.portal-main-wrapper {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    width: 100%;
    overflow-y: auto; /* Fallback for very small screens */
}

.login-center-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ── Centered Login Card ─────────────────────────────────────────────────── */
.login-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--mp-border-color);
    padding: 1.25rem 1.6rem 1.15rem 1.6rem;
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -4px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.login-card-header {
    margin-bottom: 0.75rem;
}

.mp-logo-container {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.35rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mp-emblem-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.12));
}

.user-login-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--mp-purple-primary);
    margin-bottom: 0;
    letter-spacing: 0.2px;
}

/* Department Badge */
.portal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--mp-purple-light);
    color: var(--mp-purple-primary);
    border: 1px solid #d8b4fe;
    border-radius: 20px;
    padding: 0.15rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.35rem;
}

.portal-badge-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
}

/* ── Access Restricted Card (When Direct Access or Invalid Key) ── */
.access-restricted-card {
    text-align: center;
    padding: 1rem 0.5rem;
}

.access-restricted-icon {
    width: 56px;
    height: 56px;
    background: #fef2f2;
    border: 2px solid #fee2e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem auto;
}

.access-restricted-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #991b1b;
    margin-bottom: 0.4rem;
}

.access-restricted-message {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.access-restricted-hint {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
}

/* Form Controls - Compact for Fit-to-Screen */
.form-group {
    margin-bottom: 0.65rem;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.2rem;
    display: block;
}

.required-star {
    color: var(--mp-error-red);
}

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

.input-icon {
    position: absolute;
    left: 10px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    pointer-events: none;
    z-index: 2;
}

.input-icon svg {
    width: 16px;
    height: 16px;
}

.form-input {
    width: 100%;
    padding: 0.45rem 0.75rem 0.45rem 2.15rem;
    font-size: 0.88rem;
    font-family: inherit;
    color: #1e293b;
    background-color: var(--mp-input-bg);
    border: 1.5px solid var(--mp-border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
    outline: none;
    height: 36px;
}

.form-input:focus {
    background-color: #ffffff;
    border-color: var(--mp-purple-primary);
    box-shadow: 0 0 0 2.5px rgba(89, 68, 211, 0.15);
}

.form-input.is-error {
    border-color: var(--mp-error-red);
    background-color: #fffbfa;
}

/* Password Toggle */
.password-input {
    padding-right: 2.2rem;
}

.password-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    padding: 2px;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.password-toggle:hover {
    color: #475569;
}

.icon-hidden {
    display: none !important;
}

/* Security Captcha - Compact */
.captcha-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
}

.captcha-question-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.captcha-display {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.captcha-label {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 500;
}

.captcha-code {
    font-family: Consolas, Monaco, monospace;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--mp-purple-primary);
    background: #ffffff;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    user-select: none;
    line-height: 1.2;
}

.captcha-refresh-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 4px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.captcha-refresh-btn:hover {
    background: #f1f5f9;
    color: var(--mp-purple-primary);
    border-color: var(--mp-purple-primary);
}

.captcha-refresh-btn:active svg {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

.captcha-input-wrapper {
    margin-top: 0;
}

.captcha-input {
    background-color: #ffffff;
    border: 1.5px solid #cbd5e1;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.captcha-input:focus {
    background-color: #ffffff;
    border-color: var(--mp-purple-primary);
    box-shadow: 0 0 0 3px rgba(89, 68, 211, 0.18);
}

.captcha-box:focus-within {
    border-color: #a78bfa;
    background: #faf5ff;
    transition: all 0.2s ease;
}

/* Remove number spinner arrows for all browsers */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Error Messages */
.field-error {
    display: none;
    align-items: center;
    gap: 0.25rem;
    color: var(--mp-error-red);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.2rem;
}

.field-error.visible {
    display: flex;
}

.global-error-banner {
    display: none;
    align-items: center;
    gap: 0.4rem;
    background: var(--mp-error-bg);
    border: 1px solid #fecaca;
    color: var(--mp-error-red);
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.global-error-banner.visible {
    display: flex;
}

/* Links & Checkbox */
.remember-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    font-size: 0.8rem;
}

.cursor-pointer {
    cursor: pointer;
}

.forgot-password-link {
    font-size: 0.8rem;
    color: var(--mp-purple-primary);
    text-decoration: none;
    font-weight: 600;
}

.forgot-password-link:hover {
    text-decoration: underline;
    color: var(--mp-purple-hover);
}

/* Submit Button */
.btn-signin {
    background: var(--mp-purple-primary);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    box-shadow: 0 3px 10px rgba(89, 68, 211, 0.25);
    height: 40px;
}

.btn-signin:hover {
    background: var(--mp-purple-hover);
    box-shadow: 0 5px 14px rgba(89, 68, 211, 0.35);
    transform: translateY(-1px);
}

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

.btn-signin:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-signin.loading .btn-spinner {
    display: inline-block;
}

.btn-signin.loading .btn-arrow {
    display: none;
}

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

/* ── Compact Footer (Fit-to-Screen) ─────────────────────────────────────── */
.mp-footer {
    background: #ffffff;
    border-top: 1px solid var(--mp-border-color);
    padding: 0.5rem 1rem;
    font-size: 0.78rem;
    color: #64748b;
    flex-shrink: 0;
    text-align: center;
}

.footer-note {
    font-size: 0.72rem;
    color: #94a3b8;
}

/* ── Mobile Responsive Adjustments ─────────────────────────────────────── */
@media (max-width: 576px) {
    .mp-header-title {
        font-size: 1.15rem;
    }

    .mp-header-subtitle {
        font-size: 0.88rem;
    }

    .login-card {
        padding: 1rem 1.15rem;
        max-width: 100%;
        border-radius: 8px;
    }

    .mp-logo-container {
        width: 48px;
        height: 48px;
    }

    .user-login-title {
        font-size: 1.2rem;
    }
}
