/* =========================
   Premium Auth Layout v4
   Desktop Fit Screen
   ========================= */

/*
   Tujuan versi ini:
   - Desktop/laptop tidak scroll.
   - Tinggi layout mengikuti tinggi viewport.
   - Card login dan QR lebih compact.
   - Logo tetap tanpa background putih.
   - Aksen kuning/gold tetap dipertahankan.
*/

.auth-body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 78% 20%, rgba(37, 99, 235, 0.12), transparent 32%),
        radial-gradient(circle at 18% 84%, rgba(14, 165, 233, 0.10), transparent 34%),
        linear-gradient(135deg, #f8fbff 0%, #eef5ff 48%, #f8fafc 100%);
    color: var(--text-main, #0f172a);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-wrapper {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(500px, 1.08fr) minmax(410px, 0.92fr);
    overflow: hidden;
}

/* =========================
   Left Brand Panel
   ========================= */

.auth-left {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: clamp(14px, 2vh, 28px);
    padding: clamp(26px, 4vh, 46px) clamp(36px, 4.2vw, 58px);
    overflow: hidden;
    background:
        radial-gradient(circle at 88% 46%, rgba(96, 165, 250, 0.28), transparent 28%),
        radial-gradient(circle at 9% 85%, rgba(59, 130, 246, 0.24), transparent 34%),
        radial-gradient(circle at 82% 18%, rgba(250, 204, 21, 0.17), transparent 20%),
        linear-gradient(145deg, #08256f 0%, #0e46bb 42%, #083aa8 65%, #061d63 100%);
    color: #ffffff;
}

.auth-left::before {
    content: "";
    position: absolute;
    inset: -18% -20% auto auto;
    width: 620px;
    height: 620px;
    border-radius: 50%;
    background:
        repeating-radial-gradient(circle, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 18px);
    opacity: 0.28;
    transform: rotate(-18deg);
    z-index: -3;
}

.auth-left::after {
    content: "";
    position: absolute;
    right: -120px;
    bottom: -120px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 45% 45%, rgba(250, 204, 21, 0.34), rgba(250, 204, 21, 0.08) 35%, transparent 68%);
    filter: blur(10px);
    z-index: -3;
}

.auth-brand {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-brand::after {
    content: "";
    position: absolute;
    left: 78px;
    bottom: -14px;
    width: 112px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.95), rgba(250, 204, 21, 0));
}

.auth-brand-logo {
    position: relative;
    display: flex;
    flex: 0 0 clamp(54px, 7vh, 66px);
    align-items: center;
    justify-content: center;
    width: clamp(54px, 7vh, 66px);
    height: clamp(54px, 7vh, 66px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.03));
    backdrop-filter: blur(10px);
    box-shadow:
        0 18px 34px rgba(2, 6, 23, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 0 0 1px rgba(250, 204, 21, 0.18);
    overflow: hidden;
}

.auth-brand-logo::before {
    content: "";
    position: absolute;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.16), transparent 64%);
    filter: blur(4px);
}

.auth-logo-img {
    position: relative;
    z-index: 1;
    display: block;
    width: clamp(38px, 5.4vh, 46px);
    height: clamp(38px, 5.4vh, 46px);
    object-fit: contain;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));
}

.auth-brand-title {
    margin: 0;
    color: #ffffff;
    font-size: clamp(18px, 2.4vh, 24px);
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.auth-brand-subtitle {
    margin: 4px 0 0;
    color: rgba(226, 238, 255, 0.92);
    font-size: clamp(12px, 1.75vh, 15px);
    line-height: 1.35;
}

.auth-hero {
    position: relative;
    z-index: 2;
    max-width: 680px;
}

.auth-hero::before {
    content: "Perpustakaan Modern";
    display: inline-flex;
    align-items: center;
    margin-bottom: clamp(12px, 2vh, 18px);
    padding: 7px 13px;
    border: 1px solid rgba(250, 204, 21, 0.28);
    border-radius: 999px;
    background: rgba(250, 204, 21, 0.14);
    color: #fde68a;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.auth-hero h1 {
    margin: 0;
    max-width: 660px;
    color: #ffffff;
    font-size: clamp(34px, 6.4vh, 56px);
    line-height: 1.03;
    font-weight: 950;
    letter-spacing: -0.048em;
}

.auth-hero p {
    margin: clamp(12px, 2.2vh, 20px) 0 0;
    max-width: 620px;
    color: rgba(236, 246, 255, 0.92);
    font-size: clamp(13px, 1.9vh, 16px);
    line-height: 1.65;
}

.auth-features {
    display: grid;
    gap: clamp(8px, 1.3vh, 12px);
    margin-top: clamp(18px, 3vh, 28px);
}

.auth-feature {
    display: grid;
    grid-template-columns: clamp(42px, 5.8vh, 50px) minmax(0, 1fr);
    align-items: center;
    gap: 13px;
    padding: clamp(9px, 1.4vh, 12px) 14px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    backdrop-filter: blur(8px);
    color: #f8fbff;
    font-size: clamp(13px, 1.85vh, 15px);
    line-height: 1.45;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-feature i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(42px, 5.8vh, 50px);
    height: clamp(42px, 5.8vh, 50px);
    border: 1px solid rgba(250, 204, 21, 0.32);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.24), rgba(255, 255, 255, 0.10));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 12px 24px rgba(2, 6, 23, 0.10);
    color: #fde68a;
    font-size: 17px;
}

.auth-hero-visual {
    position: absolute;
    right: 48px;
    bottom: 24px;
    z-index: -1;
    width: clamp(220px, 31vh, 300px);
    height: clamp(220px, 31vh, 300px);
    opacity: 0.35;
    pointer-events: none;
}

.auth-hero-visual::before,
.auth-hero-visual::after {
    content: "";
    position: absolute;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.auth-hero-visual::before {
    right: 10px;
    bottom: 58px;
    width: 130px;
    height: 176px;
    transform: rotate(-2deg);
}

.auth-hero-visual::after {
    right: 94px;
    bottom: 28px;
    width: 148px;
    height: 50px;
    transform: rotate(-4deg);
}

.auth-visual-book,
.auth-visual-book::before,
.auth-visual-book::after {
    position: absolute;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.30), rgba(255, 255, 255, 0.14));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.auth-visual-book {
    right: 146px;
    bottom: 90px;
    width: 44px;
    height: 128px;
    transform: rotate(-6deg);
}

.auth-visual-book::before {
    content: "";
    left: 52px;
    bottom: 0;
    width: 42px;
    height: 162px;
    transform: rotate(5deg);
}

.auth-visual-book::after {
    content: "";
    left: -44px;
    bottom: 0;
    width: 38px;
    height: 98px;
    transform: rotate(8deg);
}

.auth-footer-text {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: rgba(219, 234, 254, 0.92);
    font-size: clamp(12px, 1.65vh, 14px);
}

.auth-footer-text::before {
    content: "\f3ed";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(250, 204, 21, 0.14);
    color: #fde68a;
}

/* =========================
   Right Login Panel
   ========================= */

.auth-right {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 4vh, 38px);
    background:
        radial-gradient(circle at 36% 18%, rgba(37, 99, 235, 0.08), transparent 28%),
        radial-gradient(circle at 84% 14%, rgba(250, 204, 21, 0.12), transparent 22%),
        linear-gradient(135deg, #f8fbff, #eef5ff);
}

.auth-right::before {
    content: "";
    position: absolute;
    inset: clamp(16px, 3vh, 32px);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 34px;
    pointer-events: none;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: min(520px, calc(100vw - 48px));
    padding: clamp(24px, 4.1vh, 38px);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow:
        0 24px 70px rgba(15, 23, 42, 0.12),
        0 1px 0 rgba(255, 255, 255, 0.90) inset;
    backdrop-filter: blur(18px);
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.75), rgba(239, 246, 255, 0.25));
    pointer-events: none;
    z-index: -1;
}

.auth-card::after {
    content: "";
    position: absolute;
    left: 32px;
    right: 32px;
    top: 0;
    height: 4px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, #facc15, #f59e0b, #2563eb);
    opacity: 0.95;
}

.auth-card-header {
    display: grid;
    grid-template-columns: clamp(52px, 7vh, 64px) minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    margin-bottom: clamp(16px, 2.7vh, 24px);
}

.auth-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(52px, 7vh, 64px);
    height: clamp(52px, 7vh, 64px);
    border-radius: 20px;
    background: linear-gradient(135deg, #fef3c7, #eff6ff);
    color: #1d4ed8;
    font-size: clamp(20px, 3vh, 24px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.auth-card-title {
    margin: 0;
    color: #0f172a;
    font-size: clamp(26px, 4vh, 30px);
    font-weight: 950;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.auth-card-subtitle {
    margin: 6px 0 0;
    color: #64748b;
    font-size: clamp(12px, 1.7vh, 14px);
    line-height: 1.55;
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    padding: 11px 13px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.45;
}

.auth-alert-success {
    border: 1px solid #86efac;
    background: #dcfce7;
    color: #166534;
}

.auth-alert-danger {
    border: 1px solid #fecaca;
    background: #fee2e2;
    color: #991b1b;
}

.auth-form {
    display: grid;
    gap: clamp(11px, 1.75vh, 16px);
}

.form-group {
    display: grid;
    gap: 7px;
}

.form-label {
    color: #1e293b;
    font-size: 13px;
    font-weight: 850;
}

.input-group {
    position: relative;
}

.form-control {
    width: 100%;
    height: clamp(46px, 6.2vh, 54px);
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
    font-size: 15px;
    outline: none;
    transition: 0.22s ease;
}

.form-control.has-left-icon {
    padding-left: 48px;
}

.form-control.has-right-button {
    padding-right: 50px;
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-control:focus {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13), 0 12px 26px rgba(15, 23, 42, 0.06);
}

.input-icon-left {
    position: absolute;
    top: 50%;
    left: 17px;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 15px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: 0.2s ease;
}

.password-toggle:hover {
    background: #eff6ff;
    color: #2563eb;
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #475569;
    font-size: 13px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #475569;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
}

.auth-link {
    color: #1d4ed8;
    font-weight: 850;
    text-decoration: none;
    transition: 0.2s ease;
}

.auth-link:hover {
    color: #0f3fa6;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.auth-button,
.auth-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: clamp(46px, 6.2vh, 54px);
    border-radius: 16px;
    font-size: 15px;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    transition: 0.22s ease;
}

.auth-button {
    border: 0;
    background: linear-gradient(135deg, #1d4ed8, #2563eb 52%, #0ea5e9);
    color: #ffffff;
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.24);
}

.auth-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 34px rgba(37, 99, 235, 0.30);
    filter: saturate(1.08);
}

.auth-button:disabled,
.auth-secondary-button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
    box-shadow: none;
}

.auth-secondary-button {
    border: 1px solid #dbe3ef;
    background: rgba(255, 255, 255, 0.88);
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.auth-secondary-button:hover {
    border-color: #fcd34d;
    background: #ffffff;
    color: #1d4ed8;
    transform: translateY(-1px);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 750;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #dbe3ef, transparent);
}

.auth-back {
    margin-top: clamp(12px, 2vh, 20px);
    color: #64748b;
    font-size: 13px;
    text-align: center;
}

.auth-help-text {
    color: #64748b;
    font-size: 13px;
    line-height: 1.55;
}

/* =========================
   QR Login
   ========================= */

.qr-reader-wrapper {
    margin-bottom: 12px;
    padding: clamp(8px, 1.4vh, 12px);
    border: 1px solid #dbe3ef;
    border-radius: 22px;
    background: linear-gradient(135deg, #f8fafc, #eff6ff);
}

.qr-reader {
    width: 100%;
    min-height: clamp(190px, 30vh, 250px);
    max-height: 30vh;
    overflow: hidden;
    border: 1px dashed #bfdbfe;
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.14), transparent 32%),
        #0f172a;
}

#qr-reader video,
#qrReader video {
    width: 100% !important;
    max-height: 30vh !important;
    object-fit: cover;
    border-radius: 18px;
}

#qr-reader__dashboard_section,
#qrReader__dashboard_section {
    padding: 8px;
    color: #ffffff;
}

#qr-reader button,
#qr-reader select,
#qrReader button,
#qrReader select {
    border-radius: 12px;
    font-weight: 800;
}

.qr-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.qr-login-message {
    margin-bottom: 12px;
    padding: 11px 13px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
}

.qr-login-message-success {
    border: 1px solid #86efac;
    background: #dcfce7;
    color: #166534;
}

.qr-login-message-danger {
    border: 1px solid #fecaca;
    background: #fee2e2;
    color: #991b1b;
}

/* Backward compatibility if old QR block is used elsewhere */
.qr-box {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(190px, 30vh, 250px);
    padding: 18px;
    border: 2px dashed #bfdbfe;
    border-radius: 22px;
    background: #eff6ff;
    text-align: center;
}

.qr-box-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    border-radius: 22px;
    background: linear-gradient(135deg, #fef3c7, #dbeafe);
    color: #1d4ed8;
    font-size: 32px;
}

.qr-box-title {
    margin: 0;
    color: #0f172a;
    font-size: 18px;
    font-weight: 900;
}

.qr-box-text {
    margin: 8px 0 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}

/* =========================
   Desktop fit: jangan scroll
   ========================= */

@media (min-width: 961px) {
    html,
    body {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    .auth-body {
        height: 100vh;
        overflow: hidden;
    }

    .auth-wrapper {
        height: 100vh;
        min-height: 0;
    }

    .auth-left,
    .auth-right {
        height: 100vh;
        min-height: 0;
    }

    .auth-card {
        max-height: calc(100vh - clamp(40px, 8vh, 76px));
        overflow: hidden;
    }
}

/* Tinggi laptop umum: 720px - 820px */
@media (min-width: 961px) and (max-height: 820px) {
    .auth-left {
        padding-top: 26px;
        padding-bottom: 22px;
    }

    .auth-brand-logo {
        width: 56px;
        height: 56px;
        flex-basis: 56px;
        border-radius: 18px;
    }

    .auth-logo-img {
        width: 38px;
        height: 38px;
    }

    .auth-brand-title {
        font-size: 21px;
    }

    .auth-brand-subtitle {
        font-size: 13px;
    }

    .auth-hero::before {
        margin-bottom: 12px;
        padding: 6px 12px;
    }

    .auth-hero h1 {
        font-size: clamp(36px, 5.7vh, 46px);
        line-height: 1.04;
    }

    .auth-hero p {
        display: none;
    }

    .auth-features {
        margin-top: 20px;
        gap: 10px;
    }

    .auth-feature {
        padding: 10px 13px;
        font-size: 14px;
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .auth-feature i {
        width: 44px;
        height: 44px;
    }

    .auth-footer-text {
        font-size: 13px;
    }

    .auth-card {
        padding: 30px;
        max-width: 500px;
    }

    .auth-card-header {
        margin-bottom: 18px;
    }

    .auth-card-subtitle {
        display: none;
    }

    .form-control,
    .auth-button,
    .auth-secondary-button {
        height: 48px;
    }

    .auth-form {
        gap: 12px;
    }

    .auth-back {
        margin-top: 14px;
    }

    .qr-reader {
        min-height: 205px;
        max-height: 28vh;
    }

    #qr-reader video,
    #qrReader video {
        max-height: 28vh !important;
    }

    .qr-action-row {
        margin-bottom: 10px;
    }
}

/* Tinggi desktop sangat pendek */
@media (min-width: 961px) and (max-height: 700px) {
    .auth-left {
        padding-top: 20px;
        padding-bottom: 18px;
    }

    .auth-brand::after {
        display: none;
    }

    .auth-hero::before {
        display: none;
    }

    .auth-hero h1 {
        font-size: 38px;
    }

    .auth-features {
        margin-top: 16px;
        gap: 8px;
    }

    .auth-feature {
        padding: 8px 12px;
    }

    .auth-feature i {
        width: 40px;
        height: 40px;
    }

    .auth-card {
        padding: 24px;
    }

    .auth-card-header {
        grid-template-columns: 52px minmax(0, 1fr);
        margin-bottom: 14px;
    }

    .auth-card-icon {
        width: 52px;
        height: 52px;
    }

    .auth-card-title {
        font-size: 26px;
    }

    .form-control,
    .auth-button,
    .auth-secondary-button {
        height: 44px;
    }

    .auth-divider {
        font-size: 12px;
    }

    .qr-reader {
        min-height: 170px;
        max-height: 25vh;
    }

    #qr-reader video,
    #qrReader video {
        max-height: 25vh !important;
    }
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 1180px) {
    .auth-wrapper {
        grid-template-columns: minmax(440px, 0.95fr) minmax(400px, 1.05fr);
    }

    .auth-left {
        padding-left: 40px;
        padding-right: 40px;
    }

    .auth-hero-visual {
        opacity: 0.28;
    }
}

@media (max-width: 960px) {
    html,
    body {
        overflow: auto;
    }

    .auth-wrapper {
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .auth-left {
        display: none;
    }

    .auth-right {
        min-height: 100vh;
        height: auto;
        padding: 28px;
    }

    .auth-card {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 560px) {
    .auth-right {
        padding: 18px;
    }

    .auth-right::before {
        display: none;
    }

    .auth-card {
        padding: 26px;
        border-radius: 24px;
    }

    .auth-card-header {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .auth-card-title {
        font-size: 26px;
    }

    .auth-options,
    .qr-action-row {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }
}
