/* D-Nothi — Auth (login) */
:root {
    --auth-ink: #0f172a;
    --auth-ink-muted: #64748b;
    --auth-surface: #ffffff;
    --auth-surface-soft: #f8fafc;
    --auth-border: #e2e8f0;
    --auth-border-focus: #0d9488;
    --auth-accent: #14b8a6;
    --auth-accent-deep: #0f766e;
    --auth-panel-start: #042f2e;
    --auth-panel-end: #0f766e;
    --auth-danger: #dc2626;
    --auth-radius: 14px;
    --auth-radius-lg: 20px;
    --auth-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 12px 40px -12px rgba(15, 23, 42, 0.12);
    --font: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
}

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

body.auth-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    background: var(--auth-surface-soft);
    color: var(--auth-ink);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}

.auth-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(280px, 42%) 1fr;
    min-height: 0;
    width: 100%;
    max-width: 100%;
}

/* —— Left panel —— */
.auth-banner {
    position: relative;
    padding: clamp(2rem, 5vw, 3.75rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    overflow: hidden;
    background: linear-gradient(155deg, var(--auth-panel-start) 0%, var(--auth-accent-deep) 48%, #115e59 100%);
}

.auth-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 0%, rgba(20, 184, 166, 0.35) 0%, transparent 55%),
        radial-gradient(ellipse 60% 50% at 100% 100%, rgba(15, 118, 110, 0.5) 0%, transparent 50%);
    pointer-events: none;
}

.auth-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.9;
    pointer-events: none;
}

.auth-banner-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Uploaded logo from DB: natural colors. Fallback asset only: invert for dark green panel. */
.auth-brand-logo {
    height: clamp(40px, 5vw, 52px);
    width: auto;
    max-width: min(280px, 85%);
    object-fit: contain;
}

.auth-brand-logo--invert {
    filter: brightness(0) invert(1);
}

/* —— Right panel —— */
.auth-form-area {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: clamp(0.875rem, 2.5vw, 1.5rem);
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(clamp(0.875rem, 2.5vw, 1.5rem), env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, #fff 0%, var(--auth-surface-soft) 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.auth-form-area::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--auth-accent-deep), var(--auth-accent));
    opacity: 0;
}

.auth-form-wrap {
    width: 100%;
    max-width: 440px;
    margin-inline: auto;
    animation: authFadeUp 0.55s ease-out both;
}

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

.form-header {
    text-align: center;
    margin-bottom: 0.75rem;
}

.form-header h1 {
    margin: 0;
    font-weight: 700;
    font-size: clamp(1rem, 2.2vw, 1.125rem);
    letter-spacing: -0.02em;
    color: var(--auth-ink);
}

.auth-form-card {
    padding: 1.5rem;
    border-radius: var(--auth-radius-lg);
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    box-shadow: var(--auth-shadow);
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    line-height: 1.45;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-alert i {
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.input-container {
    margin-bottom: 1.25rem;
}

.input-container:last-of-type {
    margin-bottom: 0;
}

.input-container label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--auth-ink);
}

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

.input-wrap > .input-icon {
    position: absolute;
    left: 1rem;
    color: var(--auth-ink-muted);
    font-size: 0.9375rem;
    pointer-events: none;
    z-index: 1;
}

.form-control-modern {
    width: 100%;
    padding: 0.8125rem 1rem 0.8125rem 2.75rem;
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--auth-ink);
    background: var(--auth-surface-soft);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.form-control-modern::placeholder {
    color: #94a3b8;
}

.form-control-modern:hover {
    border-color: #cbd5e1;
}

.form-control-modern:focus {
    outline: none;
    border-color: var(--auth-border-focus);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

.form-control-modern.is-invalid {
    border-color: var(--auth-danger);
    background: #fff;
}

.form-control-modern.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.input-wrap--password .form-control-modern {
    padding-right: 3rem;
}

.btn-toggle-password {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.5rem;
    height: 2.25rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-ink-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.btn-toggle-password:hover {
    color: var(--auth-ink);
    background: rgba(15, 23, 42, 0.06);
}

.field-error {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--auth-danger);
}

.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0 0.25rem;
}

.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--auth-ink-muted);
    cursor: pointer;
    user-select: none;
}

.auth-checkbox input {
    width: 1.0625rem;
    height: 1.0625rem;
    margin: 0;
    accent-color: var(--auth-accent-deep);
    cursor: pointer;
}

.btn-auth-primary {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.9375rem 1.25rem;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    background: linear-gradient(180deg, #1e293b 0%, var(--auth-ink) 100%);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.btn-auth-primary:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
}

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

.btn-auth-primary i {
    font-size: 0.875rem;
    opacity: 0.95;
}

.forgot-link {
    display: block;
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--auth-accent-deep);
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--auth-panel-start);
    text-decoration: underline;
}

.forgot-link--secondary {
    margin-top: 0.5rem;
    font-weight: 500;
    color: #64748b;
}

.forgot-link--secondary:hover {
    color: var(--auth-accent-deep);
}

.auth-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.5;
    max-width: 100%;
    padding-inline: 0.25rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Mobile brand bar (when left panel hidden) */
.auth-mobile-brand {
    display: none;
    width: 100%;
    max-width: 100%;
    padding: max(0.875rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) 0.875rem max(1rem, env(safe-area-inset-left, 0px));
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: linear-gradient(155deg, var(--auth-panel-start) 0%, var(--auth-accent-deep) 100%);
    color: #fff;
    flex-shrink: 0;
}

.auth-mobile-brand__logo {
    height: 32px;
    max-width: 160px;
}

.auth-mobile-brand span {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Tablet / small laptop: slightly tighter split */
@media (max-width: 1100px) and (min-width: 993px) {
    .auth-grid {
        grid-template-columns: minmax(260px, 38%) 1fr;
    }
}

@media (max-width: 992px) {
    .auth-grid {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .auth-banner {
        display: none;
    }

    .auth-mobile-brand {
        display: flex;
    }

    .auth-form-area {
        justify-content: flex-start;
        padding-top: max(1rem, env(safe-area-inset-top, 0px));
    }

    .auth-form-area::before {
        opacity: 1;
    }

    .form-header {
        margin-bottom: 0.625rem;
    }

    .auth-form-card {
        padding: 1.25rem;
        border-radius: 16px;
    }

    /* 16px+ on inputs prevents iOS Safari zoom-on-focus */
    .form-control-modern {
        font-size: 1rem;
    }

    .btn-toggle-password {
        min-width: 44px;
        min-height: 44px;
        width: 2.75rem;
        height: 2.75rem;
    }

    .btn-auth-primary {
        min-height: 48px;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .forgot-link {
        padding: 0.5rem;
        margin-inline: -0.5rem;
    }

    .auth-footer {
        padding-top: 1.75rem;
        font-size: 0.6875rem;
    }
}

/* Narrow phones */
@media (max-width: 400px) {
    .form-header h1 {
        font-size: 0.9375rem;
    }

    .auth-form-card {
        padding: 1.125rem;
    }

    .auth-mobile-brand span {
        font-size: 0.875rem;
    }
}

/* Landscape phone: keep form scrollable without crowding */
@media (max-width: 992px) and (max-height: 500px) {
    .auth-form-area {
        justify-content: flex-start;
    }

    .form-header {
        margin-bottom: 0.5rem;
    }

    .auth-footer {
        padding-top: 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-form-wrap {
        animation: none;
    }

    .btn-auth-primary:hover {
        transform: none;
    }
}
