/**
 * The Google (Customizations\GoogleAuth) and Facebook (Customizations\FacebookAuth)
 * sign-in / sign-up buttons ("… ile giriş yap" / "… ile kayıt ol") in Platea's
 * sign-in / sign-up box and on wp-login.php, the "veya" divider, the
 * "E-posta ile giriş yap / kayıt ol" button and the toast of a failed sign-in.
 *
 * Platea prints its social login slot at the end of the form, under the
 * "Şifrenizi mi kaybettiniz? / Hesap Oluştur" links; the forms become flex
 * columns so the slot comes first. Its e-mail fields stay hidden until the
 * e-mail button (a checkbox in the slot) is ticked. Without :has() support
 * everything is shown.
 */

#gt-sign-in-form,
#gt-sign-up-form {
    display: flex;
    flex-direction: column;
}

#gt-sign-in-form > .input-group:has(.gt-social-login),
#gt-sign-up-form > .input-group:has(.gt-social-login) {
    order: -1;
}

#gt-sign-in-form > .input-group:has(.gt-links),
#gt-sign-up-form > .input-group:has(.gt-links) {
    order: 2;
}

/* Messages right above the fields (after the social buttons and "veya"),
   where the eye is when a sign-in fails; they were under the links. */
#gt-sign-in-form > .gt-notices,
#gt-sign-up-form > .gt-notices {
    order: -1;
}

/* Signed in: only the green box stays while the page reloads. */
#gt-sign-in-form:has(.yt-notice--success) > :not(.gt-notices) {
    display: none !important;
}

#gt-sign-in-form:has(.yt-notice--success) > .gt-notices {
    margin: .5rem 0 !important;
}

#gt-sign-in-form > .gt-notices:has(.yt-notice),
#gt-sign-up-form > .gt-notices:has(.yt-notice) {
    margin: 0 0 1rem;
}

#gt-sign-in-form:has(.yt-email-toggle:not(:checked)) > .input-group:not(:has(.gt-social-login, .gt-links)),
#gt-sign-up-form:has(.yt-email-toggle:not(:checked)) > .input-group:not(:has(.gt-social-login, .gt-links)),
#gt-sign-in-form:has(.yt-email-toggle:not(:checked)) .gt-links li:not(.gt-show-large) {
    display: none;
}

/* The fields slide in one after the other once the e-mail button is ticked
   (@starting-style: browsers without it show them at once). The social
   buttons, shown from the start, are not animated. */
#gt-sign-in-form:has(.yt-email-toggle:checked) > .input-group:not(:has(.gt-social-login)),
#gt-sign-up-form:has(.yt-email-toggle:checked) > .input-group:not(:has(.gt-social-login)) {
    transition: opacity .3s ease, transform .3s ease;
}

@starting-style {
    #gt-sign-in-form:has(.yt-email-toggle:checked) > .input-group:not(:has(.gt-social-login)),
    #gt-sign-up-form:has(.yt-email-toggle:checked) > .input-group:not(:has(.gt-social-login)) {
        opacity: 0;
        transform: translateY(-8px);
    }
}

#gt-sign-in-form > .input-group:nth-child(2),
#gt-sign-up-form > .input-group:nth-child(2) {
    transition-delay: .05s;
}

#gt-sign-in-form > .input-group:nth-child(3),
#gt-sign-up-form > .input-group:nth-child(3) {
    transition-delay: .1s;
}

#gt-sign-in-form > .input-group:nth-child(n+4),
#gt-sign-up-form > .input-group:nth-child(n+4) {
    transition-delay: .15s;
}

@media (prefers-reduced-motion: reduce) {
    #gt-sign-in-form > .input-group,
    #gt-sign-up-form > .input-group {
        transition: none !important;
    }
}

/* Platea's popup (style 1) has a fixed height (min-height 550px, 500px below
   1200px) and an absolutely positioned white half, so the open e-mail form
   ran over its top and bottom. The white half now sets the height: at least
   the popup's own, taller when the form needs it. fancybox's slide is a
   flex column that would shrink the popup to the screen; it scrolls instead. */
body .gt-user-box-popup.gt-style-1 {
    flex-shrink: 0;
}

/* One height for every state (sign-in / sign-up, e-mail form closed or open):
   that of the tallest, the open sign-in form (with the Instagram button), so switching never resizes the
   popup. Never taller than the screen, where the open form scrolls instead. */
body .gt-user-box-popup.gt-style-1 {
    min-height: min(740px, calc(100dvh - 2rem));
}

@media (max-width: 1199px) {
    body .gt-user-box-popup.gt-style-1 {
        min-height: min(720px, calc(100dvh - 2rem));
    }
}

/* Phones: the popup is the white half only and as tall as its content; the
   fixed height left a large empty band above the buttons. */
@media (max-width: 767px) {
    body .gt-user-box-popup.gt-style-1 {
        min-height: 0;
    }
}

body .gt-user-box-popup.gt-style-1 .gt-content {
    position: relative;
    height: auto;
    min-height: inherit;
}

.gt-social-login {
    width: 100%;
}

.yt-google-or {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 0 0 1rem;
    color: #8a8a8a;
    font-size: .875rem;
}

.yt-google-or::before,
.yt-google-or::after {
    content: "";
    flex: 1;
    border-top: 1px solid #e3e3e3;
}

/* :visited too: Platea's a:visited (link colour) has the same specificity and is printed later. */
a.yt-google-button,
a.yt-google-button:visited {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    width: 100%;
    min-height: 52px;
    padding: .75rem 1rem;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fff;
    color: #3c4043;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease;
}

a.yt-google-button:hover,
a.yt-google-button:focus {
    border-color: #c6c9cc;
    background: #f7f8f8;
    color: #3c4043;
}

a.yt-google-button svg {
    flex: none;
}

a.yt-facebook-button,
a.yt-facebook-button:visited {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    width: 100%;
    min-height: 52px;
    margin-top: .75rem;
    padding: .75rem 1rem;
    border: 1px solid #1877f2;
    border-radius: 8px;
    background: #1877f2;
    color: #fff;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color .15s ease;
}

a.yt-facebook-button:hover,
a.yt-facebook-button:focus {
    border-color: #166fe5;
    background: #166fe5;
    color: #fff;
}

a.yt-facebook-button svg {
    flex: none;
}

a.yt-instagram-button,
a.yt-instagram-button:visited {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    width: 100%;
    min-height: 52px;
    margin-top: .75rem;
    padding: .75rem 1rem;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(45deg, #f58529 0%, #dd2a7b 50%, #8134af 100%);
    color: #fff;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: filter .15s ease;
}

a.yt-instagram-button:hover,
a.yt-instagram-button:focus {
    color: #fff;
    filter: brightness(.94);
}

a.yt-instagram-button svg {
    flex: none;
}

/* Instagram only signs members in (InstagramAuth): no button in sign-up forms. */
#gt-sign-up-form a.yt-instagram-button {
    display: none;
}

#login a.yt-instagram-button {
    box-sizing: border-box;
    min-height: 44px;
    margin: 0 0 16px;
}

.gt-social-login a + .yt-google-or {
    margin-top: 1rem;
}

label.yt-email-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: .75rem 1rem;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fff;
    color: #3c4043;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: normal;
    line-height: 1.2;
    text-transform: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

label.yt-email-button:hover,
label.yt-email-button:has(:focus-visible) {
    border-color: #c6c9cc;
    background: #f7f8f8;
}

label.yt-email-button:has(:focus-visible) {
    outline: 2px solid #3c4043;
    outline-offset: 2px;
}

label.yt-email-button:has(.yt-email-toggle:checked) {
    display: none;
}

label.yt-email-button .yt-email-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

label.yt-email-button svg {
    flex: none;
}

.yt-auth-sign-up,
#gt-sign-up-form .yt-auth-sign-in {
    display: none;
}

#gt-sign-up-form .yt-auth-sign-up {
    display: inline;
}

#login a.yt-facebook-button {
    margin: 0 0 16px;
}

#login a.yt-google-button,
#login a.yt-facebook-button {
    box-sizing: border-box;
    min-height: 44px;
}

#login .yt-google-or {
    margin-top: 16px;
}

#login a.yt-google-button {
    margin: 0 0 16px;
}

.yt-google-notice {
    position: fixed;
    bottom: 24px;
    left: 50%;
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 1em;
    max-width: calc(100% - 32px);
    padding: .8em 1em;
    border-radius: 8px;
    background: #8e1c1c;
    color: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
    transform: translateX(-50%);
}

.yt-google-notice button {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-size: 1.4em;
    line-height: 1;
    cursor: pointer;
}

/* Messages of the sign-in / sign-up popup as alert boxes (WpLoginRedirect::
   popupNotices() wraps Platea's plain message): red when signing in failed
   (shakes once), green with a spinner while the page reloads signed in. */
.gt-user-box-popup .gt-notices .yt-notice {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    margin: 0;
    padding: .8rem 1rem;
    border: 1px solid;
    border-radius: 12px;
    font-size: .9375rem;
    line-height: 1.45;
    text-align: left;
    animation: yt-notice-in .25s ease;
}

body .gt-user-box-popup .gt-notices .yt-notice p {
    margin: 0;
    padding: 0;
}

.gt-user-box-popup .gt-notices .yt-notice-icon {
    flex: none;
    display: flex;
    margin-top: 1px;
}

.gt-user-box-popup .gt-notices .yt-notice-text {
    flex: 1 1 auto;
    min-width: 0;
}

.gt-user-box-popup .gt-notices .yt-notice--error {
    border-color: #f5c2b8;
    background: #fff1ee;
    color: #8a1f0c;
    animation: yt-notice-in .25s ease, yt-notice-shake .4s ease .05s;
}

.gt-user-box-popup .gt-notices .yt-notice--error .yt-notice-icon {
    color: #d92d0b;
}

.gt-user-box-popup .gt-notices .yt-notice--error a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.gt-user-box-popup .gt-notices .yt-notice--success {
    align-items: center;
    border-color: #b9dfc6;
    background: #edf8f1;
    color: #14532d;
    font-weight: 600;
}

.gt-user-box-popup .gt-notices .yt-notice--success .yt-notice-icon {
    color: #1f8a4c;
}

.gt-user-box-popup .gt-notices .yt-notice-spinner {
    flex: none;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    opacity: .6;
    animation: yt-notice-spin .7s linear infinite;
}

@keyframes yt-notice-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

@keyframes yt-notice-shake {
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

@keyframes yt-notice-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .gt-user-box-popup .gt-notices .yt-notice,
    .gt-user-box-popup .gt-notices .yt-notice--error {
        animation: none;
    }

    .gt-user-box-popup .gt-notices .yt-notice-spinner {
        animation-duration: 2s;
    }
}

/* A field the popup's own check refused (WpLoginRedirect::popupNotices()). */
.gt-user-box-popup form input[aria-invalid="true"] {
    border-color: #d92d0b;
    box-shadow: 0 0 0 3px rgba(217, 45, 11, .12);
}
