@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700&family=Nunito+Sans:wght@400;600;700&display=swap');

:root {
    --zp-bg: #04130d;
    --zp-deep: #06170e;
    --zp-station: #0e2d1d;
    --zp-gold: #f7c51e;
    --zp-gold-soft: #f3cd66;
    --zp-cream: #f4e4b5;
    --zp-btn-text: #504419;
    --zp-shadow: 0 4px 5.9px rgba(0, 0, 0, 0.25);
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
}

.auth-modal[hidden] {
    display: none;
}

body.is-auth-open {
    overflow: hidden;
}

.auth-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 10, 6, 0.62);
    -webkit-backdrop-filter: blur(14px) saturate(0.8);
    backdrop-filter: blur(14px) saturate(0.8);
}

.auth-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 28px 24px 24px;
    border-radius: 14px;
    border: 0.5px solid rgba(243, 205, 102, 0.45);
    background: linear-gradient(165deg, rgba(14, 45, 29, 0.98) 0%, rgba(6, 23, 14, 0.98) 100%);
    color: var(--zp-cream);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), var(--zp-shadow);
    font-family: 'Nunito Sans', sans-serif;
}

.auth-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0.5px solid rgba(243, 205, 102, 0.35);
    border-radius: 50%;
    background: rgba(4, 19, 13, 0.65);
    color: var(--zp-gold-soft);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.auth-modal__close:hover {
    background: rgba(14, 45, 29, 0.9);
}

.auth-modal__close:active {
    transform: scale(0.96);
}

.auth-modal__brand {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.auth-modal__brand img {
    width: 120px;
    height: auto;
    object-fit: contain;
}

.auth-modal__title {
    margin: 0 0 16px;
    font-family: 'Baloo 2', cursive;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--zp-gold-soft);
    text-align: center;
}

.auth-modal__hint {
    margin: -6px 0 14px;
    font-size: 13px;
    line-height: 1.45;
    color: rgba(244, 228, 181, 0.78);
    text-align: center;
}

.auth-modal__footer {
    margin: 14px 0 0;
    font-size: 11px;
    line-height: 1.45;
    color: rgba(244, 228, 181, 0.55);
    text-align: center;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.auth-tabs[hidden] {
    display: none;
}

.auth-tab {
    flex: 1;
    padding: 10px 8px;
    border: 0.5px solid rgba(243, 205, 102, 0.35);
    border-radius: 8px;
    background: rgba(4, 19, 13, 0.55);
    color: rgba(244, 228, 181, 0.75);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.auth-tab.is-active {
    border-color: var(--zp-gold-soft);
    background: rgba(243, 205, 102, 0.14);
    color: var(--zp-gold-soft);
}

.auth-form__label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(244, 228, 181, 0.82);
}

.auth-form__input {
    width: 100%;
    padding: 11px 12px;
    margin-bottom: 14px;
    border: 0.5px solid rgba(243, 205, 102, 0.35);
    border-radius: 8px;
    background: rgba(4, 19, 13, 0.72);
    color: var(--zp-cream);
    font-family: inherit;
    font-size: 15px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-form__input::placeholder {
    color: rgba(244, 228, 181, 0.35);
}

.auth-form__input:focus {
    border-color: var(--zp-gold-soft);
    box-shadow: 0 0 0 2px rgba(243, 205, 102, 0.15);
}

.auth-form__link-row {
    margin: -4px 0 14px;
    text-align: right;
}

.auth-form__link {
    border: none;
    background: none;
    padding: 0;
    color: var(--zp-gold-soft);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.auth-form__actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.auth-form__btn {
    flex: 1;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 9px;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.01em;
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.auth-form__btn.zp-btn--gold {
    border: 1px solid #967509;
    background: linear-gradient(145deg, #ffd94f 0%, #f7c51e 75%);
    color: #504419;
    box-shadow: 0 4px 0 #9f7c0d, 0 8px 18px rgba(247, 197, 30, 0.18);
}

.auth-form__btn.zp-btn--ghost {
    border: 1px solid rgba(243, 205, 102, 0.65);
    background: rgba(4, 19, 13, 0.72);
    color: var(--zp-gold-soft);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
}

.auth-form__btn:hover {
    filter: brightness(1.08);
}

.auth-form__btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.auth-form__status {
    min-height: 0;
    margin: 12px 0 0;
    padding: 0;
    font-size: 13px;
    line-height: 1.4;
    color: transparent;
    transition: color 0.15s ease;
}

.auth-form__status:not(:empty) {
    padding: 10px 12px;
    border-radius: 8px;
}

.auth-form__status.is-error:not(:empty) {
    color: #ffc9c0;
    background: rgba(192, 57, 43, 0.18);
    border: 0.5px solid rgba(231, 76, 60, 0.35);
}

.auth-form__status.is-success:not(:empty) {
    color: #c8f0c0;
    background: rgba(39, 174, 96, 0.16);
    border: 0.5px solid rgba(46, 204, 113, 0.35);
}

.auth-form__status.is-loading:not(:empty) {
    color: rgba(244, 228, 181, 0.85);
    background: rgba(243, 205, 102, 0.1);
    border: 0.5px solid rgba(243, 205, 102, 0.25);
}

.auth-form.is-busy .auth-form__btn,
.auth-form.is-busy .auth-form__input {
    pointer-events: none;
    opacity: 0.72;
}

.auth-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 100002;
    display: flex;
    align-items: center;
    max-width: min(400px, calc(100% - 32px));
    min-height: 44px;
    padding: 11px 18px;
    border: 1px solid rgba(46, 204, 113, 0.5);
    border-radius: 9px;
    background: rgba(4, 19, 13, 0.94);
    color: #c8f0c0;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
    font: 700 13px/1.4 'Nunito Sans', sans-serif;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.auth-toast::before {
    content: '✓';
    display: inline-grid;
    place-items: center;
    width: 21px;
    height: 21px;
    margin-right: 9px;
    border-radius: 50%;
    background: rgba(46, 204, 113, 0.2);
    color: #8fe383;
}

.auth-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Auth buttons on pages (home, gallery) */
.auth-bar {
    display: contents;
}

.auth-bar__login,
.auth-bar__account,
.auth-bar__logout {
    min-width: 0;
}

.auth-bar__account {
    max-width: 100%;
    overflow: hidden;
}

.auth-bar__account span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-bar__account img {
    width: 11px;
    height: 14px;
    flex-shrink: 0;
}

.auth-bar__logout {
    font-size: 10px;
}

.gallery-auth-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    width: 100%;
    margin-top: 4px;
}

.gallery-auth-bar .zp-btn {
    min-width: 140px;
}

.gallery-auth-bar[hidden] {
    display: none;
}

.gallery-item.is-uploading {
    opacity: 0.5;
    pointer-events: none;
}

.gallery-upload-status {
    margin: 12px 0;
    padding: 10px 14px;
    border-radius: 8px;
    border: 0.5px solid rgba(243, 205, 102, 0.35);
    background: rgba(4, 19, 13, 0.82);
    color: var(--zp-cream);
    font-size: 14px;
    text-align: center;
}

.gallery-upload-status[data-type='success'] {
    border-color: rgba(46, 204, 113, 0.45);
    background: rgba(39, 174, 96, 0.16);
    color: #c8f0c0;
}

.gallery-upload-status[data-type='error'] {
    border-color: rgba(231, 76, 60, 0.4);
    background: rgba(192, 57, 43, 0.18);
    color: #ffc9c0;
}

.gallery-upload-status[data-type='loading'] {
    border-color: rgba(243, 205, 102, 0.4);
    color: var(--zp-gold-soft);
}

.gallery-upload-status[hidden] {
    display: none;
}

#addNewBtn:disabled,
#addMediaBtn:disabled {
    cursor: wait;
    opacity: 0.55;
}

@media (min-width: 1024px) {
    .auth-modal__dialog {
        padding: 32px 28px 28px;
    }

    .auth-modal__title {
        font-size: 24px;
    }

    .auth-form__btn {
        font-size: 13px;
    }
}
