:root {
    --primary-green: #4CAF50;
    --secondary-purple: #8A2BE2;
    --font-family: 'Poppins', sans-serif;
    --card-radius: 16px;
    --card-shadow: 0 20px 40px rgba(0, 0, 0, 0.16);
}

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

html {
    height: 100%;
}

body {
    background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)),
                url('https://images.unsplash.com/photo-1498837167922-ddd27525d352?q=80&w=2070&auto=format&fit=crop')
                no-repeat center center / cover;
    font-family: var(--font-family);
    min-height: 100%;
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    margin: 0;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
}

body.in-app-browser {
    background: #f3f4f6;
    padding: 24px;
}

.page-container {
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 0 auto;
}

.brand {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fff;
    text-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.brand .logo-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.16);
    display: grid;
    place-items: center;
    font-size: 1.3rem;
}

.brand strong {
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.brand small {
    font-size: 0.85rem;
    opacity: 0.85;
}

.form-card {
    width: 100%;
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 40px 36px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-header h1 {
    font-size: 1.95rem;
    font-weight: 700;
    color: #1f2937;
}

.form-header p {
    font-size: 0.95rem;
    color: #6b7280;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.18);
}

.form-error-message {
    min-height: 1.1em;
    font-size: 0.78rem;
    color: #e74c3c;
    text-align: left;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.form-error-message.active {
    opacity: 1;
}

.has-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.15);
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #4b5563;
    margin-top: 4px;
}

.remember-me input {
    width: auto;
}

.btn-primary {
    width: 100%;
    margin-top: 6px;
    padding: 14px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary-green), #58c26d);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
    box-shadow: 0 10px 22px rgba(76, 175, 80, 0.25);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-primary[disabled],
.btn-primary.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.forgot-password-link {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--secondary-purple);
    font-weight: 600;
    text-decoration: none;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

.forgot-password-link.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.form-footer {
    text-align: center;
    font-size: 0.9rem;
    color: #4b5563;
}

.form-footer .link {
    color: var(--secondary-purple);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
}

.form-footer .link:hover {
    text-decoration: underline;
}

.page-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.page-footer a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.page-footer a:hover {
    text-decoration: underline;
}

body.in-app-browser .brand {
    color: #1f2937;
    text-shadow: none;
}

body.in-app-browser .page-footer {
    color: #4b5563;
}

body.in-app-browser .page-footer a {
    color: var(--secondary-purple);
}

@media (max-width: 600px) {
    body {
        display: block;
        padding: 18px;
    }

    .page-container {
        max-width: 100%;
        align-items: stretch;
    }

    .brand {
        justify-content: center;
    }

    .form-card {
        margin-top: 12px;
        padding: 28px 22px;
        border-radius: 14px;
        box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
    }

    .form-header h1 {
        font-size: 1.6rem;
    }

    .btn-primary {
        padding: 12px;
        font-size: 0.9rem;
    }

    .page-footer {
        font-size: 0.85rem;
    }
}

@media (min-width: 900px) {
    .page-container {
        max-width: 960px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
        align-items: stretch;
        gap: 36px;
    }

    .brand {
        align-self: stretch;
        flex-direction: column;
        justify-content: center;
        background: rgba(255, 255, 255, 0.14);
        padding: 48px 42px;
        border-radius: var(--card-radius);
        box-shadow: var(--card-shadow);
        text-shadow: none;
        color: #1f2937;
    }

    .brand strong {
        font-size: 2rem;
        color: #111827;
        letter-spacing: 0.6px;
    }

    .brand small {
        font-size: 1.05rem;
        color: #4b5563;
        opacity: 1;
    }

    body.in-app-browser .brand {
        background: #fff;
        box-shadow: var(--card-shadow);
    }

    .form-card {
        padding: 48px 44px;
    }
}
