@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=DM+Sans:wght@400;500;700&display=swap');

:root {
    --page-bg: #f4f7fb;
    --shell-bg: #ffffff;
    --ink: #071226;
    --ink-soft: #3c4c5f;
    --muted: #7b8ba4;
    --accent: #cf2335;
    --accent-soft: #fbe4e7;
    --accent-dark: #aa1b2a;
    --stroke: #e1e8f2;
    --panel-shadow: 0 30px 80px rgba(7, 18, 38, 0.08);
    --drawer-bg: #ffffff;
}

html, body {
    min-height: 100%;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body.login {
    font-family: 'DM Sans', 'Space Grotesk', sans-serif;
    margin: 0;
    padding: clamp(24px, 4vw, 60px);
    background: #e6eef7;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100vh;
    overflow-x: hidden;
}

body.login::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, rgba(244,247,251,0.7) 0%, rgba(230,238,247,0.62) 60%, rgba(253,246,246,0.68) 100%),
                var(--login-hero-image, url('https://nooruse5.ee/wp-content/uploads/2026/03/nooruse5hoone.jpg')) center/cover no-repeat;
}

@media (min-width: 960px) {
    body.login {
        align-items: center;
    }
}

body.login #login {
    width: 100%;
}

.portal-login-shell {
    width: min(1180px, 100%);
    margin: auto 0;
    display: grid;
    grid-template-columns: minmax(320px, 1.1fr) minmax(360px, 0.9fr);
    gap: clamp(24px, 4vw, 48px);
    background: var(--shell-bg);
    border-radius: 32px;
    padding: clamp(26px, 4vw, 46px);
    box-shadow: var(--panel-shadow);
    border: 1px solid rgba(7, 18, 38, 0.04);
}

.portal-hero {
    position: relative;
    border-radius: 28px;
    overflow: hidden;
    min-height: 520px;
    background: #fff;
}

.portal-hero .hero-visual {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 18% 20%, rgba(255,255,255,0.9), transparent 55%),
        radial-gradient(circle at 82% 12%, rgba(255,196,160,0.4), transparent 45%),
        linear-gradient(135deg, #fdf9f5 0%, #f2f4ff 50%, #e7f3ff 100%);
    background-size: cover;
    background-position: center;
}

.portal-hero .hero-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(130,170,255,0.28) 0%, rgba(254,216,185,0.35) 45%, transparent 70%) no-repeat;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    padding: clamp(26px, 5vw, 48px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    color: var(--ink);
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(7, 18, 38, 0.08);
    border-radius: 999px;
    padding: 6px 18px;
    font-size: 0.8rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

.hero-content h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.2rem, 3.4vw, 3.4rem);
    margin: 0;
    line-height: 1.1;
}

.hero-lede {
    font-size: 1.05rem;
    color: var(--ink-soft);
    max-width: 460px;
    margin: 0 0 4px;
}

.hero-notice {
    background: #fff;
    border-radius: 18px;
    padding: 18px 20px;
    border: 1px solid rgba(7, 18, 38, 0.08);
    box-shadow: 0 20px 40px rgba(7, 18, 38, 0.05);
}

.hero-notice-label {
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
}

.hero-info-grid {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.hero-drawer-stack {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.portal-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-card {
    background: #fff;
    color: var(--ink);
    border-radius: 28px;
    padding: clamp(22px, 3vw, 34px);
    box-shadow: 0 25px 70px rgba(7, 18, 38, 0.08);
    border: 1px solid rgba(7, 18, 38, 0.04);
}

.login-card-head {
    margin-bottom: 14px;
}

.login-card-head .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0 0 8px;
}

.login-card-head h2 {
    margin: 0 0 8px;
    font-size: 2rem;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--ink);
}

.login-card-head p {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.5;
}

.login-card-body {
    position: relative;
}

.login-card-foot {
    margin-top: 16px;
    font-size: 0.95rem;
    color: var(--ink-soft);
}

.login-card-foot a {
    color: var(--accent);
    font-weight: 600;
}

.login-card-content {
    width: 100%;
}

#login {
    padding: 0;
}

#login h1, #login .message, #login .notice, #login #login_error {
    text-align: left;
}

#login h1 a {
    background: url('https://nooruse5.ee/wp-content/uploads/2025/03/ttkk-logo-2025-et_punane.png') no-repeat center;
    background-size: contain;
    width: 180px;
    height: 72px;
    margin: 0 0 12px;
    text-indent: -9999px;
    display: block;
}


#loginform,
#registerform,
#lostpasswordform,
#resetpassform {
    background: transparent;
    border: 1px solid var(--stroke);
    border-radius: 18px;
    padding: 18px 22px;
    box-shadow: none;
}

#resetpassform {
    overflow: visible;
}

#loginform label,
#registerform label,
#lostpasswordform label {
    font-weight: 600;
    color: var(--ink);
}

#loginform input[type="text"],
#loginform input[type="password"],
#loginform input[type="email"],
#registerform input[type="text"],
#registerform input[type="email"],
#lostpasswordform input[type="text"],
#resetpassform input[type="password"],
#resetpassform input[type="text"] {
    border-radius: 14px;
    border: 1px solid rgba(7, 18, 38, 0.12);
    padding: 10px 14px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#loginform input:focus,
#registerform input:focus,
#lostpasswordform input:focus,
#resetpassform input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(207, 35, 53, 0.2);
    outline: none;
}

/* Password strength meter spacing and rounding */
.login #pass-strength-result {
    margin-top: 6px;
    border-radius: 10px;
}

/* Password toggle eye icon */
.login .wp-hide-pw .dashicons {
    color: var(--accent);
}

.login .button.wp-hide-pw:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
    outline: none;
}

/* Checkbox accent */
#loginform input[type="checkbox"]:checked::before,
#registerform input[type="checkbox"]:checked::before,
#resetpassform input[type="checkbox"]:checked::before {
    content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23cf2335%27%2F%3E%3C%2Fsvg%3E");
}

#loginform input[type="checkbox"]:focus,
#registerform input[type="checkbox"]:focus,
#resetpassform input[type="checkbox"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(207, 35, 53, 0.2);
    outline: none;
}

/* Notice / message border-left */
.login .message, .login .notice, .login .success {
    border-left-color: var(--accent);
}

.wp-core-ui .button-primary {
    background: linear-gradient(130deg, var(--accent), #f45a60);
    border: none;
    border-radius: 14px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-shadow: none;
    box-shadow: 0 18px 32px rgba(207, 35, 53, 0.25);
}

.wp-core-ui .button-primary:hover,
.wp-core-ui .button-primary:focus,
.wp-core-ui .button-primary:active {
    background: linear-gradient(130deg, var(--accent-dark), #ea404b);
    border-color: transparent;
    box-shadow: 0 18px 32px rgba(207, 35, 53, 0.3);
    outline: none;
}

.wp-core-ui .button.wp-generate-pw {
    border: 2px solid var(--accent);
    border-radius: 14px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    background: transparent;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    line-height: 1.4;
}

.wp-core-ui .button.wp-generate-pw:hover,
.wp-core-ui .button.wp-generate-pw:focus {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    outline: none;
}

/* Confirm password field styling */
.user-pass2-wrap label {
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

/* Make password labels bold */
#resetpassform .user-pass1-wrap label,
#resetpassform .user-pass2-wrap label {
    font-weight: 600;
}

/* Consistent placeholder styling across password fields */
#resetpassform input::placeholder {
    font-size: 1rem;
    color: rgba(7, 18, 38, 0.35);
}

/* Confirm password field same size as main password field */
#resetpassform #pass2 {
    width: 100%;
    box-sizing: border-box;
}

.reset-pass-submit {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

#nav, .privacy-policy-page-link {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 0.9rem;
    color: var(--muted);
}

#nav a, .privacy-policy-page-link a {
    color: var(--accent);
    font-weight: 600;
}

.language-switcher {
    display: none;
}

.info-chip {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(7, 18, 38, 0.08);
    border-radius: 18px;
    padding: 14px 16px;
    color: var(--ink);
    text-align: left;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 12px 30px rgba(7, 18, 38, 0.04);
    width: 100%;
    position: relative;
    will-change: transform;
}

.info-chip::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 14px 32px rgba(207, 35, 53, 0.18);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.info-chip span {
    font-weight: 600;
    font-size: 1.02rem;
}

.info-chip small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.85rem;
}

.info-chip em {
    font-style: normal;
    color: var(--accent);
}

.info-chip.is-active,
.info-chip:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.info-chip.is-active::after,
.info-chip:hover::after {
    opacity: 1;
}

.login-drawer {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s ease, opacity 0.05s ease;
    opacity: 0;
    margin: 0;
    width: 100%;
    will-change: grid-template-rows, opacity;
}

.login-drawer > .drawer-inner {
    overflow: hidden;
    background: var(--drawer-bg);
    border-radius: 22px;
    box-shadow: 0 30px 70px rgba(7, 18, 38, 0.08);
    border: 1px solid rgba(7, 18, 38, 0.05);
    color: var(--ink);
    min-height: 0;
    padding: 0;
}

.login-drawer.is-visible {
    grid-template-rows: 1fr;
    opacity: 1;
    margin: 18px 0 0 0;
    transition: grid-template-rows 0.4s ease, opacity 0.3s ease 0.05s;
}

.login-drawer.is-visible > .drawer-inner {
    padding: clamp(20px, 3vw, 30px);
}

.drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.drawer-head h3 {
    margin: 0;
    font-size: 1.5rem;
    font-family: 'Space Grotesk', sans-serif;
}

.drawer-close {
    border: none;
    background: rgba(7, 18, 38, 0.06);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    flex-shrink: 0;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.drawer-body {
    margin-top: 16px;
}

.drawer-body h2 {
    margin: 1.4em 0 0.5em;
    font-size: 1.05rem;
}

.drawer-body h2:first-child {
    margin-top: 0;
}

.drawer-body p {
    margin: 0.6em 0;
}

.drawer-body ul,
.drawer-body ol {
    padding-left: 1.5em;
    margin: 0.5em 0;
}

.drawer-body li {
    margin-bottom: 0.3em;
}

/* Ensure empty divs/paragraphs in kontakt render as spacing */
.kontakt-section div:empty,
.kontakt-section p:empty {
    min-height: 1.2em;
    display: block;
}

.faq-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    border: 1px solid rgba(7, 18, 38, 0.08);
    border-radius: 16px;
    background: #f8fbff;
}

.faq-question {
    width: 100%;
    background: transparent;
    border: none;
    padding: 16px 20px;
    font-size: 1rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 600;
    color: #122545;
}

.faq-indicator {
    font-size: 1.2rem;
    color: var(--accent);
    transition: transform 0.2s ease;
}

.faq-question.open .faq-indicator {
    transform: rotate(90deg);
}

.faq-answer {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    will-change: grid-template-rows, opacity;
}

.faq-answer-inner {
    overflow: hidden;
    min-height: 0;
    padding: 0 20px 0 48px;
    font-size: 0.95rem;
    color: #32435a;
    line-height: 1.6;
}

.faq-question.open + .faq-answer {
    grid-template-rows: 1fr;
    opacity: 1;
}

.faq-question.open + .faq-answer .faq-answer-inner {
    padding-bottom: 18px;
}

.teade-form-container {
    background: #f9fbff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(7, 18, 38, 0.07);
    padding: 26px;
}

.teade-logo {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 90px;
}

@media (max-width: 1024px) {
    .portal-login-shell {
        grid-template-columns: 1fr;
        width: 100%;
    }
    .portal-hero {
        min-height: 420px;
    }
}

@media (max-width: 640px) {
    body.login {
        padding: 12px;
    }
    .portal-login-shell {
        padding: 14px;
        border-radius: 22px;
        box-shadow: 0 10px 30px rgba(7, 18, 38, 0.06);
    }
    .portal-hero {
        min-height: auto;
    }
    .hero-content {
        padding: 20px;
    }
    .hero-content h1 {
        font-size: 1.7rem;
    }
    .login-card {
        box-shadow: 0 8px 24px rgba(7, 18, 38, 0.06);
    }
    .login-drawer > .drawer-inner {
        box-shadow: 0 10px 30px rgba(7, 18, 38, 0.06);
    }
    .hero-info-grid {
        grid-template-columns: 1fr;
    }
    .hero-drawer-stack {
        gap: 12px;
    }
    #nav, .privacy-policy-page-link {
        flex-direction: row;
        gap: 6px;
    }

    /* Kill heavy animations on mobile — snap open/close instead */
    .login-drawer {
        transition: opacity 0.15s ease;
        will-change: opacity;
    }
    .login-drawer.is-visible {
        transition: opacity 0.15s ease;
    }
    .info-chip {
        transition: border-color 0.15s ease;
        will-change: auto;
    }
    .info-chip:hover,
    .info-chip.is-active {
        transform: none;
    }
    .faq-answer {
        transition: none;
        will-change: auto;
    }
    .faq-indicator {
        transition: transform 0.15s ease;
    }
}

/* ── Hide "Back to blog" on login ── */
.login #backtoblog { display: none; }
