:root {
    --bg1: #f7f9ff;
    --bg2: #eef3fb;
    /* Uygulama yazı tipi (giriş + üst şerit) */
    --etas-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --text: #0f172a;
    --line: rgba(37, 99, 235, 0.14);
    --panel-border: rgba(37, 99, 235, 0.16);
    /* Üst şerit + sol taşımalı logosu (büyük) için yeterli yükseklik */
    --header-h: clamp(72px, 15.5vmin, 112px);
    --footer-h: clamp(36px, 10vmin, 52px);
    /* Kart içi dikey ritim (zoom ile birlikte küçülür) */
    --login-gap-xs: clamp(2px, 0.45vmin, 5px);
    --login-gap-sm: clamp(3px, 0.65vmin, 7px);
    --login-gap-md: clamp(4px, 0.85vmin, 9px);
}

html.login-html,
html.login-html body.login-body {
    margin: 0;
    /* Kaydırma .login-page içinde: zoom’da çift çubuk olmasın */
    overflow-x: hidden;
    overflow-y: hidden;
    min-height: 100%;
    min-height: -webkit-fill-available;
}

@supports (height: 100dvh) {
    html.login-html,
    html.login-html body.login-body {
        min-height: 100dvh;
        height: 100dvh;
    }
}

* {
    box-sizing: border-box;
}

body.login-body {
    font-family: var(--etas-font);
    color: var(--text);
    /*
     * rbo.css html,body arka planını burada ezmemek: aynı rota görseli + çok hafif ton.
     * (Yalnızca gradient kullanılınca görsel kayboluyordu.)
     */
    background-color: #dce6ef;
    background-image:
        linear-gradient(180deg, rgba(247, 249, 255, 0.42) 0%, rgba(238, 243, 251, 0.32) 100%),
        url("../images/tasimali_ogrenci_assets/background_route_1x1.png");
    background-repeat: no-repeat, no-repeat;
    background-position: center top, center top;
    -webkit-background-size: cover, cover;
    background-size: cover, cover;
    background-attachment: fixed, fixed;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: clamp(4px, 1.2vmin, 8px);
    padding-left: max(clamp(12px, 3vw, 20px), env(safe-area-inset-left, 0px));
    padding-right: max(clamp(12px, 3vw, 20px), env(safe-area-inset-right, 0px));
    min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
    height: auto;
    font-family: var(--etas-font);
    background: linear-gradient(180deg, rgba(247, 249, 255, 0.96) 0%, rgba(238, 243, 251, 0.9) 100%);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
    z-index: 10;
    font-weight: 800;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-left img {
    height: auto;
    width: auto;
    max-height: min(calc(var(--header-h) - 6px), 118px);
    max-width: min(70vw, 560px);
    object-fit: contain;
    display: block;
}

.header-right img {
    height: auto;
    max-height: calc(var(--header-h) - 14px);
    width: auto;
    object-fit: contain;
    display: block;
}

/*
 * Orta alan: zoom / büyük yazıda kart taşarsa kart içi değil bu alan kayar —
 * MEBBİS dahil tüm panel erişilebilir.
 */
.login-page {
    position: fixed;
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
    bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: clamp(6px, 1vmin, 12px);
    padding-bottom: clamp(6px, 1vmin, 12px);
    padding-left: max(clamp(6px, 1.4vmin, 12px), env(safe-area-inset-left, 0px));
    padding-right: max(clamp(6px, 1.4vmin, 12px), env(safe-area-inset-right, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.login-page::before {
    content: "";
    position: absolute;
    inset: -40px;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='1000'%3E%3Cg fill='none' stroke='%2394a3b8' stroke-opacity='0.25' stroke-width='1'%3E%3Cpath d='M-80 170 C 220 50, 480 300, 820 170 S 1280 240, 1720 90'/%3E%3Cpath d='M-120 280 C 200 160, 520 360, 860 260 S 1320 320, 1760 170'/%3E%3Cpath d='M-120 420 C 260 300, 560 520, 900 400 S 1380 520, 1760 370'/%3E%3C/g%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
}

.login-card {
    position: relative;
    z-index: 20;
    width: min(420px, 100%);
    max-width: 420px;
    min-width: 0;
    height: auto;
    max-height: none;
    flex: 0 0 auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    margin-top: auto;
    margin-bottom: auto;
}

.login-card-ui {
    flex: 0 0 auto;
    width: 100%;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: visible;
    gap: 0;
    font-family: var(--etas-font);
    padding: clamp(0px, 0.3vmin, 4px) clamp(10px, 2.2vw, 18px) clamp(2px, 0.5vmin, 6px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(247, 249, 255, 0.97) 100%);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(30, 64, 175, 0.09);
}

/* Üst blok: max-height kaldırıldı — kesilme yok, başlık formun üstüne binmez */
.login-card-top {
    flex: 0 0 auto;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 0;
}

.brand-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    width: 100%;
    max-height: none;
    /* Logo ile alt satırlar: sıkı ama bindirmesiz (flex gap) */
    gap: clamp(4px, 0.55vmin, 10px);
    padding: 0 2px;
    overflow: visible;
    margin-bottom: 0;
}

.brand-head .mini-logo {
    display: block;
    margin: 0;
    width: auto;
    height: auto;
    max-width: min(100%, 460px);
    /* Zoom’da dikey taşmayı azalt; metin logoya vmin ile yakın kalır */
    max-height: min(24vmin, 26vh, 168px);
    object-fit: contain;
    flex-shrink: 0;
}

.brand-head .org {
    font-weight: 900;
    color: #475569;
    font-size: clamp(12px, 2.75vmin, 16px);
    line-height: 1.35;
    padding: 0 4px;
    margin: 0;
}

.login-card-ui .brand-head .title {
    font-size: clamp(14px, 3.25vmin, 20px);
    font-weight: 900;
    margin: 0;
    padding: 0 4px clamp(2px, 0.45vmin, 6px);
    letter-spacing: -0.3px;
    line-height: 1.35;
}

.login-card-top .alert-ui {
    margin-top: var(--login-gap-sm);
    flex-shrink: 1;
    min-height: 0;
    max-height: 28%;
    overflow: hidden;
    padding: clamp(6px, 1.2vmin, 10px) clamp(8px, 1.5vmin, 12px);
    font-size: clamp(9px, 1.9vmin, 12px);
}

/* Kaydırma kart içinde değil: .login-page taşır; başlık–form çakışması olmaz */
.login-card-main {
    flex: 0 0 auto;
    overflow: visible;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
    margin-top: clamp(4px, 0.5vmin, 10px);
    padding-bottom: clamp(6px, 0.9vmin, 12px);
}

.field {
    margin: 0;
    flex: 0 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.login-card-main > .field:nth-of-type(1) {
    margin-bottom: clamp(8px, 1.2vmin, 14px);
}

.login-card-main > .field:nth-of-type(2) {
    margin-bottom: clamp(8px, 1.2vmin, 14px);
}

.login-card-main > .field:nth-of-type(3) {
    margin-bottom: clamp(9px, 1.35vmin, 16px);
}

.login-card-main > .btn-wrap:not(.btn-wrap-secondary) {
    margin-bottom: clamp(6px, 0.95vmin, 12px);
}

.login-card-main > .help-note {
    margin-bottom: clamp(6px, 0.95vmin, 12px);
}

.field label {
    font-weight: 900;
    font-size: clamp(10px, 2vmin, 12px);
    margin-bottom: clamp(4px, 0.65vmin, 8px);
    display: block;
    line-height: 1.2;
}

.textbox-ui {
    width: 100%;
    min-width: 0;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    padding: clamp(4px, 0.75vmin, 8px) clamp(8px, 1.5vw, 11px);
    font-size: clamp(11px, 2.1vmin, 13px);
    line-height: 1.25;
}

.textbox-ui:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
    outline: none;
}

.captcha-row {
    display: grid;
    grid-template-columns: minmax(96px, 36%) minmax(0, 1fr);
    gap: var(--login-gap-sm);
    align-items: center;
    min-height: 0;
}

.captcha-img {
    width: 100% !important;
    max-width: 160px;
    height: auto !important;
    min-height: 0;
    max-height: clamp(28px, 6.5vmin, 40px);
    aspect-ratio: 4 / 1;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #fff;
}

.btn-wrap {
    position: relative;
    flex: 0 0 auto;
    flex-shrink: 0;
    height: clamp(32px, 5.8vh, 42px);
    min-height: 32px;
    max-height: 44px;
}

.btn-wrap-secondary {
    margin-top: 0;
    margin-bottom: 0;
    flex-shrink: 0;
}

.btn-fake {
    height: 100%;
    min-height: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: clamp(11px, 2.6vmin, 14px);
    user-select: none;
}

.btn-primary {
    background: linear-gradient(180deg, #2563eb, #1e40af);
    color: #fff;
    box-shadow: 0 10px 22px rgba(30, 64, 175, 0.16);
}

.btn-primary:hover {
    filter: brightness(1.03);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.95));
    border: 1px solid rgba(148, 163, 184, 0.65);
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.btn-secondary:hover {
    filter: brightness(1.02);
}

.btn-secondary:active {
    transform: translateY(1px);
}

.btn-hit {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    opacity: 0;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.btn-solid {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 900;
    font-size: 11px;
    position: relative;
    z-index: 30;
    pointer-events: auto;
    cursor: pointer;
}

.btn-primary-solid {
    background: linear-gradient(180deg, #2563eb, #1e40af);
    color: #fff;
}

.btn-secondary-solid {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.95));
    border-color: rgba(148, 163, 184, 0.65);
    color: #0f172a;
}

.help-note {
    margin: 0;
    flex: 0 0 auto;
    flex-shrink: 0;
    color: #b91c1c;
    font-weight: 900;
    font-size: clamp(9px, 2vmin, 12px);
    line-height: 1.35;
    text-align: center;
    overflow: visible;
    padding: 4px 4px 2px;
}

.help-note span {
    white-space: normal;
    word-break: break-word;
}

.alert-ui {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 12px;
    color: #b91c1c;
    margin: 0;
    font-weight: 800;
}

.page-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
    font-family: var(--etas-font);
    font-size: clamp(10px, 2.2vw, 12px);
    color: #64748b;
    z-index: 5;
    min-height: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px));
    height: auto;
    line-height: 1.35;
    padding: clamp(6px, 1.4vmin, 10px) max(8px, env(safe-area-inset-left, 0px))
        max(clamp(6px, 1.4vmin, 10px), env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-right, 0px));
    background: linear-gradient(180deg, rgba(247, 249, 255, 0.95) 0%, rgba(238, 243, 251, 0.92) 100%);
    border-top: 1px solid var(--line);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 900px) {
    .app-header {
        padding: 6px 14px;
    }

    .login-card {
        max-width: min(400px, 100%);
    }
}

@media (max-width: 560px) {
    :root {
        /* Mobil: logo büyük; şerit biraz yükselir */
        --header-h: clamp(58px, 14.5vmin, 76px);
    }

    .app-header {
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        text-align: center;
        padding-left: max(8px, env(safe-area-inset-left, 0px));
        padding-right: max(8px, env(safe-area-inset-right, 0px));
    }

    .header-left,
    .header-right {
        flex: 1 1 50%;
        min-width: 0;
        max-width: 50%;
        justify-content: center;
    }

    .header-left img {
        max-width: 100%;
        width: auto;
        height: auto;
        max-height: min(calc(var(--header-h) - 6px), 88px);
    }

    .header-right img {
        max-width: 100%;
        width: auto;
        height: auto;
    }

    .captcha-row {
        grid-template-columns: 1fr;
    }

    .captcha-img {
        max-width: 100% !important;
        aspect-ratio: auto;
        max-height: clamp(36px, 10vw, 48px);
        object-fit: contain;
    }

    .login-card {
        max-width: 100%;
        width: 100%;
    }

    .login-card-ui {
        border-radius: 12px;
        padding-left: max(clamp(8px, 2vw, 14px), env(safe-area-inset-left, 0px));
        padding-right: max(clamp(8px, 2vw, 14px), env(safe-area-inset-right, 0px));
    }

    .brand-head {
        gap: clamp(4px, 0.9vw, 10px);
    }

    .brand-head .mini-logo {
        max-height: min(22vmin, 20vh, 100px);
    }

    .brand-head .org {
        font-size: clamp(11px, 3.2vw, 14px);
        margin: 0;
    }

    .login-card-ui .brand-head .title {
        font-size: clamp(12px, 3.6vw, 17px);
        margin: 0;
    }

    /* iOS: odakta otomatik yakınlaştırmayı önlemek için */
    .textbox-ui {
        font-size: 16px;
    }

}

/* Tablet / alçak ekran: logo biraz küçülür, kart yine tek parça */
@media (max-height: 640px) and (min-width: 561px) {
    .brand-head .mini-logo {
        max-height: min(20vmin, 18vh, 120px);
    }
}

@media (max-height: 560px) and (min-width: 561px) {
    .brand-head .mini-logo {
        max-height: min(18vmin, 16vh, 104px);
    }

    .captcha-img {
        max-height: clamp(24px, 5.2vmin, 34px);
    }

    .login-card-main > .field:nth-of-type(1),
    .login-card-main > .field:nth-of-type(2) {
        margin-bottom: clamp(6px, 1vmin, 10px);
    }

    .login-card-main > .field:nth-of-type(3) {
        margin-bottom: clamp(7px, 1.1vmin, 12px);
    }
}

@media (max-width: 560px) and (max-height: 620px) {
    .brand-head .mini-logo {
        max-height: min(18vmin, 14vh, 76px);
    }
}
