/*
 * หน้า Login (resources/views/auth/login.blade.php)
 * ปรับสีหลักของหน้าได้ที่ตัวแปรใน :root ด้านล่าง
 */

:root {
    --login-primary: #696cff;
    --login-primary-dark: #4b4ee6;
    --login-violet: #8c57ff;
    --login-ink: #2b2c40;
    --login-muted: #8592a3;
    --login-surface: #ffffff;
    --login-field: #f5f5f9;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'IBM Plex Sans Thai', 'Public Sans', sans-serif;
    background: var(--login-surface);
    color: var(--login-ink);
}

.login-shell {
    display: flex;
    min-height: 100vh;
}

/* ---------- ฝั่งซ้าย: hero ---------- */
.login-hero {
    position: relative;
    flex: 1 1 56%;
    overflow: hidden;
    color: #fff;
    padding: 3rem 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(135deg, #3b3fd8 0%, var(--login-primary) 45%, var(--login-violet) 100%);
    background-size: 200% 200%;
    animation: heroGradient 14s ease-in-out infinite;
}

@keyframes heroGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ลายจุดจาง ๆ */
.login-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .18) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), transparent 85%);
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), transparent 85%);
    pointer-events: none;
}

.hero-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .55;
    pointer-events: none;
    animation: blobFloat 18s ease-in-out infinite;
}

.hero-blob.b1 { width: 380px; height: 380px; background: #b9a6ff; top: -120px; left: -80px; }
.hero-blob.b2 { width: 300px; height: 300px; background: #03c3ec; bottom: -100px; right: 10%; animation-delay: -6s; opacity: .35; }
.hero-blob.b3 { width: 220px; height: 220px; background: #ff6ec4; top: 40%; right: -60px; animation-delay: -12s; opacity: .3; }

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, 30px) scale(1.08); }
    66% { transform: translate(-30px, 20px) scale(.95); }
}

.hero-top,
.hero-copy,
.hero-tickets,
.hero-bottom {
    position: relative;
    z-index: 1;
}

.hero-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    letter-spacing: .2px;
}

/* โลโก้บริษัท: พื้นขาวเพื่อให้โลโก้ทุกสีอ่านออกบนพื้นม่วง */
.hero-logo {
    display: block;
    width: 80px;
    height: 80px;
    padding: 8px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    overflow: hidden;
    flex-shrink: 0;
}

/* รูปต้องไม่ล้นกรอบ: บังคับขนาดเท่ากรอบ แล้วย่อให้พอดีโดยไม่ตัดรูป */
.hero-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hero-brand {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.hero-company {
    font-size: 1.3rem;
    font-weight: 700;
}

.hero-app {
    font-size: .95rem;
    font-weight: 400;
    color: rgba(255, 255, 255, .8);
}

.hero-copy h1 {
    color: #fff;
    font-size: clamp(2rem, 3vw, 2.75rem);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 1rem;
}

.hero-copy h1 .accent {
    background: linear-gradient(90deg, #fff, #d7ccff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-copy p {
    color: rgba(255, 255, 255, .85);
    font-size: 1.05rem;
    max-width: 30rem;
    margin-bottom: 1.5rem;
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .85rem;
    border-radius: 999px;
    font-size: .85rem;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .25);
    backdrop-filter: blur(6px);
}

/* การ์ด ticket ลอย ๆ */
.hero-tickets {
    position: relative;
    height: 250px;
    max-width: 440px;
}

.ticket-card {
    position: absolute;
    width: 300px;
    padding: .9rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 18px 40px rgba(24, 20, 90, .28);
    animation: ticketFloat 7s ease-in-out infinite;
}

.ticket-card.t1 { top: 0; left: 0; }
.ticket-card.t2 { top: 82px; left: 90px; animation-delay: -2.3s; }
.ticket-card.t3 { top: 164px; left: 30px; animation-delay: -4.6s; }

@keyframes ticketFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.ticket-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .78rem;
    color: rgba(255, 255, 255, .8);
    margin-bottom: .35rem;
}

.ticket-title {
    font-weight: 600;
    font-size: .95rem;
}

.ticket-status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .1rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    background: rgba(255, 255, 255, .9);
}

.ticket-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-new { color: #ff9f43; }
.status-doing { color: #03a3c8; }
.status-done { color: #56ca00; }

/* แถวล่าง: © ชื่อบริษัท (ซ้าย) และลิงก์ผู้พัฒนา (ขวา) ในแถวเดียวกัน เหมือน footer ของระบบ */
.hero-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .5rem 1rem;
    font-size: .85rem;
    color: rgba(255, 255, 255, .7);
}

.hero-bottom .footer-link {
    color: rgba(255, 255, 255, .8);
    text-decoration: none;
    transition: color .2s;
}

.hero-bottom .footer-link:hover,
.hero-bottom .footer-link:focus-visible {
    color: #fff;
    text-decoration: underline;
}

/* ---------- ฝั่งขวา: ฟอร์ม ---------- */
.login-panel {
    flex: 1 1 44%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    background:
        radial-gradient(circle at 100% 0%, rgba(105, 108, 255, .08), transparent 40%),
        radial-gradient(circle at 0% 100%, rgba(140, 87, 255, .07), transparent 45%),
        var(--login-surface);
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.login-logo {
    display: block;
    width: 96px;
    height: 96px;
    padding: 10px;
    border-radius: 22px;
    object-fit: contain;
    background: #fff;
    border: 1px solid rgba(105, 108, 255, .12);
    box-shadow: 0 10px 25px rgba(105, 108, 255, .18);
    flex-shrink: 0;
}

.login-company {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--login-ink);
    line-height: 1.3;
}

.login-app {
    font-size: .9rem;
    color: var(--login-primary);
    font-weight: 500;
}

.login-greeting {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    font-weight: 500;
    color: var(--login-primary);
    background: rgba(105, 108, 255, .1);
    padding: .3rem .75rem;
    border-radius: 999px;
    margin-bottom: .9rem;
}

.login-box h2 {
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: .35rem;
    color: var(--login-ink);
}

.login-sub {
    color: var(--login-muted);
    margin-bottom: 2rem;
}

.login-box .form-label {
    font-weight: 500;
    font-size: .85rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--login-ink);
}

.field-wrap {
    position: relative;
}

.field-wrap .field-icon {
    position: absolute;
    left: 1rem;
    top: 1.55rem;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--login-muted);
    pointer-events: none;
    transition: color .2s;
    z-index: 4;
}

.field-wrap .form-control {
    height: 3.1rem;
    padding-left: 2.85rem;
    border-radius: 12px;
    border: 1.5px solid transparent;
    background: var(--login-field);
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.field-wrap .form-control:focus {
    background: #fff;
    border-color: var(--login-primary);
    box-shadow: 0 0 0 4px rgba(105, 108, 255, .14);
}

.field-wrap:focus-within .field-icon {
    color: var(--login-primary);
}

.field-wrap.has-toggle .form-control {
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: .5rem;
    top: 1.55rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--login-muted);
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    z-index: 4;
}

.toggle-password:hover,
.toggle-password:focus-visible {
    color: var(--login-primary);
    background: rgba(105, 108, 255, .08);
    outline: none;
}

.caps-warning {
    display: none;
    align-items: center;
    gap: .3rem;
    margin-top: .45rem;
    font-size: .8rem;
    color: #ff9f43;
}

.caps-warning.show {
    display: flex;
}

.btn-login {
    position: relative;
    width: 100%;
    height: 3.1rem;
    border: 0;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
    background: linear-gradient(135deg, var(--login-primary), var(--login-violet));
    background-size: 150% 150%;
    box-shadow: 0 10px 24px rgba(105, 108, 255, .35);
    transition: transform .15s, box-shadow .2s, background-position .4s;
    overflow: hidden;
}

.btn-login:hover {
    background-position: 100% 0;
    box-shadow: 0 14px 30px rgba(105, 108, 255, .45);
    transform: translateY(-1px);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login .btn-arrow {
    transition: transform .2s;
}

.btn-login:hover .btn-arrow {
    transform: translateX(4px);
}

.btn-login .spinner-border {
    display: none;
    width: 1.1rem;
    height: 1.1rem;
    border-width: 2px;
}

.btn-login.is-loading {
    pointer-events: none;
    opacity: .9;
}

.btn-login.is-loading .spinner-border {
    display: inline-block;
}

.btn-login.is-loading .btn-arrow {
    display: none;
}

.login-footer {
    margin-top: 2.5rem;
    text-align: center;
    font-size: .8rem;
    color: var(--login-muted);
}

/* เข้าทีละส่วน */
.reveal {
    opacity: 0;
    transform: translateY(14px);
    animation: reveal .7s cubic-bezier(.2, .7, .2, 1) forwards;
}

.reveal.d1 { animation-delay: .05s; }
.reveal.d2 { animation-delay: .12s; }
.reveal.d3 { animation-delay: .19s; }
.reveal.d4 { animation-delay: .26s; }
.reveal.d5 { animation-delay: .33s; }
.reveal.d6 { animation-delay: .4s; }

@keyframes reveal {
    to { opacity: 1; transform: none; }
}

/* มือถือ / แท็บเล็ต: ซ่อน hero แสดงเฉพาะฟอร์ม */
@media (max-width: 991.98px) {
    .login-hero {
        display: none;
    }

    .login-panel {
        background:
            radial-gradient(circle at 100% 0%, rgba(105, 108, 255, .18), transparent 45%),
            radial-gradient(circle at 0% 100%, rgba(140, 87, 255, .14), transparent 50%),
            var(--login-surface);
    }
}


@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
