/* ── Modern Auth Form (scoped, override mainauth.css) ── */

/* ─── Stage ─── */
.auth-stage {
    position: relative;
    max-width: 500px;
    margin: 16px auto;
    padding: 30px 20px;
}
.auth-deco {
    position: absolute;
    pointer-events: none;
    opacity: .85;
    filter: drop-shadow(0 6px 14px rgba(212,175,55,.35));
    will-change: transform;
    z-index: 1;
}
.auth-deco-1 { top: -8px;  left: -18px; width: 60px; animation: floatA 6s ease-in-out infinite; }
.auth-deco-2 { top: 40px;  right: -22px; width: 56px; animation: floatB 7s ease-in-out infinite .5s; }
.auth-deco-3 { bottom: 30px; left: -22px; width: 52px; animation: floatA 8s ease-in-out infinite 1s; }
.auth-deco-4 { bottom: -8px; right: -10px; width: 64px; animation: floatB 7.5s ease-in-out infinite 1.5s; }
@keyframes floatA {
    0%, 100% { transform: translateY(0) rotate(-6deg); }
    50%      { transform: translateY(-14px) rotate(4deg); }
}
@keyframes floatB {
    0%, 100% { transform: translateY(0) rotate(8deg); }
    50%      { transform: translateY(-12px) rotate(-5deg); }
}
@media (max-width: 480px) {
    .auth-deco-1 { width: 44px; top: 0; left: -10px; }
    .auth-deco-2 { width: 42px; top: 60px; right: -12px; }
    .auth-deco-3 { width: 40px; bottom: 60px; left: -10px; }
    .auth-deco-4 { width: 48px; bottom: 10px; right: -8px; }
}

/* ─── Frame ─── */
.auth-frame {
    position: relative;
    border-radius: 24px;
    padding: 1.5px;
    background: linear-gradient(135deg,
        var(--color-accent, #dfa041) 0%,
        rgba(245,218,171,.55) 25%,
        var(--color-accent, #dfa041) 50%,
        rgba(245,218,171,.55) 75%,
        var(--color-accent, #dfa041) 100%);
    background-size: 300% 300%;
    animation: borderShift 8s ease infinite;
    box-shadow:
        0 20px 60px rgba(0,0,0,.5),
        0 0 60px rgba(223,160,65,.18);
    z-index: 2;
}
@keyframes borderShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}
.auth-frame::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 28px;
    background: radial-gradient(circle at 50% 0%, rgba(223,160,65,.25), transparent 70%);
    z-index: -1;
    animation: glowPulse 4s ease-in-out infinite;
}
@keyframes glowPulse {
    0%, 100% { opacity: .5; }
    50%      { opacity: 1; }
}

.auth-card {
    position: relative;
    /* พื้นหลังตามธีมที่ตั้งจากหลังบ้าน — primary/header + accent glow */
    background:
        radial-gradient(circle at 0% 0%, rgba(var(--color-accent-rgb, 223,160,65), .12), transparent 45%),
        radial-gradient(circle at 100% 100%, rgba(var(--color-button-rgb, 26,126,255), .08), transparent 45%),
        linear-gradient(180deg,
            rgba(var(--color-header-rgb, 0,26,80), .94) 0%,
            rgba(var(--color-primary-rgb, 1,20,61), .96) 100%);
    border-radius: 22.5px;
    padding: 26px 22px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: cardIn .6s cubic-bezier(.2,.8,.2,1);
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
}
.auth-logo img {
    display: block;
    margin: 0 auto;
    max-width: 160px;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.35));
}
.auth-title {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: .5px;
    background: linear-gradient(90deg, #fff 0%, var(--color-accent, #dfa041) 50%, #fff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShimmer 4s linear infinite;
}
@keyframes titleShimmer {
    to { background-position: -200% center; }
}
.auth-subtitle {
    text-align: center;
    color: rgba(255,255,255,.55);
    font-size: .88rem;
    margin: 0 0 22px;
}
.auth-alert {
    background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.3);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: .86rem;
    margin-bottom: 10px;
}
.auth-row { margin-bottom: 14px; }
.auth-row label {
    display: block;
    font-size: .82rem;
    font-weight: 500;
    color: rgba(255,255,255,.75);
    margin-bottom: 6px;
}
.auth-row label .optional {
    color: rgba(255,255,255,.4);
    font-weight: 400;
    margin-left: 4px;
}
.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    transition: border-color .15s, background .15s;
}
.auth-input-wrap:focus-within {
    border-color: var(--color-accent, #dfa041);
    background: rgba(255,255,255,.08);
}
.auth-input-icon {
    flex-shrink: 0;
    width: 42px;
    text-align: center;
    color: rgba(255,255,255,.45);
    font-size: 1rem;
    line-height: 1;
}
.auth-input-wrap input,
.auth-input-wrap select {
    flex: 1;
    min-width: 0;
    background: transparent !important;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 13px 8px 13px 0 !important;
    color: #fff !important;
    font-size: .95rem !important;
    font-weight: 400 !important;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
}
.auth-input-wrap input::placeholder { color: rgba(255,255,255,.35); }
.auth-input-wrap select option { background:#1a1a25; color:#fff; }
.auth-input-wrap.has-select::after {
    content: '▾';
    position: absolute;
    right: 14px;
    color: rgba(255,255,255,.45);
    pointer-events: none;
}
.auth-toggle {
    flex-shrink: 0;
    width: 42px;
    background: transparent;
    border: 0;
    color: rgba(255,255,255,.45);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}
.auth-toggle:hover { color: rgba(255,255,255,.8); }
.auth-hint {
    display: block;
    font-size: .78rem;
    margin-top: 5px;
    padding-left: 4px;
}
.auth-hint.err { color: #fca5a5; }
.auth-submit {
    display: block;
    width: 100%;
    padding: 14px;
    margin: 18px 0 0;
    background: linear-gradient(135deg, var(--color-button, #2563eb), var(--color-button-hover, #1d4ed8));
    color: #fff;
    border: 0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .5px;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled { opacity:.6; cursor:not-allowed; transform:none; }
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 14px;
    color: rgba(255,255,255,.3);
    font-size: .75rem;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,.1);
}
.auth-forgot {
    display: block;
    text-align: center;
    color: rgba(255,255,255,.6);
    font-size: .85rem;
    text-decoration: none;
    padding: 8px;
    border-radius: 8px;
    transition: color .15s, background .15s;
}
.auth-forgot:hover {
    color: #fff;
    background: rgba(255,255,255,.05);
    text-decoration: none;
}
.auth-forgot i { margin-right: 4px; opacity: .7; }
.auth-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px;
    margin-top: 10px;
    background: #06C755;
    color: #fff;
    border: 0;
    border-radius: 12px;
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all .2s;
    box-shadow: 0 4px 14px rgba(6,199,85,.35);
}
.auth-line:hover {
    background: #05a648;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(6,199,85,.45);
}
.auth-line svg { width: 20px; height: 20px; flex-shrink: 0; }
.auth-footer {
    text-align: center;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    color: rgba(255,255,255,.5);
    font-size: .88rem;
}
.auth-footer a {
    color: var(--color-accent, #dfa041);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
}
.auth-footer a:hover { text-decoration: underline; }
/* Floating decorative icons (chip/card/coin/dice) */
.auth-deco {
    position: absolute;
    pointer-events: none;
    opacity: .85;
    filter: drop-shadow(0 6px 14px rgba(212,175,55,.35));
    will-change: transform;
    z-index: 1;
}
.auth-deco-1 { top: -8px;  left: -18px; width: 60px; animation: floatA 6s ease-in-out infinite; }
.auth-deco-2 { top: 40px;  right: -22px; width: 56px; animation: floatB 7s ease-in-out infinite .5s; }
.auth-deco-3 { bottom: 30px; left: -22px; width: 52px; animation: floatA 8s ease-in-out infinite 1s; }
.auth-deco-4 { bottom: -8px; right: -10px; width: 64px; animation: floatB 7.5s ease-in-out infinite 1.5s; }
@keyframes floatA {
    0%, 100% { transform: translateY(0) rotate(-6deg); }
    50%      { transform: translateY(-14px) rotate(4deg); }
}
@keyframes floatB {
    0%, 100% { transform: translateY(0) rotate(8deg); }
    50%      { transform: translateY(-12px) rotate(-5deg); }
}
@media (max-width: 480px) {
    .auth-deco-1 { width: 44px; top: 0; left: -10px; }
    .auth-deco-2 { width: 42px; top: 60px; right: -12px; }
    .auth-deco-3 { width: 40px; bottom: 60px; left: -10px; }
    .auth-deco-4 { width: 48px; bottom: 10px; right: -8px; }
}
