

:root {
    --primary: #f97316;
    --primary-light: #fb923c;
    --primary-dark: #ea580c;
    --primary-darker: #c2410c;
    --secondary: #ff6b35;
    --accent: #ffb347;

    --bg-light: #fff7ed;
    --bg-white: #ffffff;
    --bg-cream: #fffbf5;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-bg-solid: #ffffff;

    --text-dark: #1c1917;
    --text-main: #292524;
    --text-secondary: #44403c;
    --text-muted: #78716c;
    --text-light: #a8a29e;

    --border: rgba(249, 115, 22, 0.15);
    --border-light: rgba(0, 0, 0, 0.08);
    --border-focus: rgba(249, 115, 22, 0.4);

    --glow-primary: rgba(249, 115, 22, 0.25);
    --glow-soft: rgba(249, 115, 22, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 24px rgba(249, 115, 22, 0.12);
    --shadow-lg: 0 20px 50px rgba(249, 115, 22, 0.15);
    --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.08);

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Kanit', sans-serif;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-cream) 50%, #fff5eb 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.login-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.login-background::before {
    content: '';
    position: absolute;
    inset: -50%;
    background:
        radial-gradient(ellipse 80% 50% at 20% 30%, rgba(249, 115, 22, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 85% 70%, rgba(255, 179, 71, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 50% 30% at 50% 90%, rgba(251, 146, 60, 0.1) 0%, transparent 50%);
    animation: backgroundShift 25s ease-in-out infinite;
}

@keyframes backgroundShift {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    25% {
        transform: translate(3%, -3%) rotate(1deg) scale(1.02);
    }

    50% {
        transform: translate(-3%, 3%) rotate(-1deg) scale(1);
    }

    75% {
        transform: translate(2%, 2%) rotate(0.5deg) scale(1.01);
    }
}

.grid-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(249, 115, 22, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(249, 115, 22, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
}

.particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    animation: float 18s infinite ease-in-out;
}

.particle:nth-child(1) {
    width: 12px;
    height: 12px;
    left: 8%;
    top: 15%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    opacity: 0.5;
    animation-delay: 0s;
    animation-duration: 14s;
}

.particle:nth-child(2) {
    width: 8px;
    height: 8px;
    left: 18%;
    top: 55%;
    background: var(--primary-light);
    opacity: 0.4;
    animation-delay: 2s;
    animation-duration: 16s;
}

.particle:nth-child(3) {
    width: 14px;
    height: 14px;
    left: 82%;
    top: 25%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary-light) 100%);
    opacity: 0.45;
    animation-delay: 4s;
    animation-duration: 18s;
}

.particle:nth-child(4) {
    width: 6px;
    height: 6px;
    left: 75%;
    top: 75%;
    background: var(--primary);
    opacity: 0.35;
    animation-delay: 1s;
    animation-duration: 15s;
}

.particle:nth-child(5) {
    width: 10px;
    height: 10px;
    left: 28%;
    top: 78%;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    opacity: 0.4;
    animation-delay: 3s;
    animation-duration: 17s;
}

.particle:nth-child(6) {
    width: 5px;
    height: 5px;
    left: 92%;
    top: 12%;
    background: var(--accent);
    opacity: 0.5;
    animation-delay: 5s;
    animation-duration: 13s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(15px, -25px) rotate(90deg);
    }

    50% {
        transform: translate(-8px, 15px) rotate(180deg);
    }

    75% {
        transform: translate(12px, 8px) rotate(270deg);
    }
}

.login-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1000px;
    min-height: 580px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 20px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card), 0 0 0 1px var(--border-light);
    animation: cardAppear 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-branding {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 40%, var(--accent) 100%);
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-branding::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    animation: patternMove 35s linear infinite;
}

.login-branding::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    top: -100px;
    right: -100px;
    animation: circlePulse 8s ease-in-out infinite;
}

@keyframes circlePulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.08;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.12;
    }
}

@keyframes patternMove {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 60px 60px;
    }
}

.branding-content {
    position: relative;
    z-index: 1;
}

.branding-icon {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    font-size: 48px;
    color: white;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: iconPulse 2.5s ease-in-out infinite;
}

@keyframes iconPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4), 0 15px 35px rgba(0, 0, 0, 0.15);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(255, 255, 255, 0), 0 15px 35px rgba(0, 0, 0, 0.15);
    }
}

.branding-title {
    color: white;
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.branding-subtitle {
    color: rgba(255, 255, 255, 0.95);
    font-size: 16px;
    font-weight: 300;
    max-width: 280px;
    line-height: 1.7;
}

.branding-features {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    font-weight: 400;
}

.feature-item i {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.login-card {
    background: var(--card-bg-solid);
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-header {
    margin-bottom: 36px;
}

.login-header h1 {
    color: var(--text-dark);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 300;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-group {
    position: relative;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
}

.form-group label i {
    color: var(--primary);
    font-size: 12px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 16px;
    transition: var(--transition-normal);
    pointer-events: none;
    z-index: 1;
}

.form-input {
    width: 100%;
    background: var(--bg-cream);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 16px 16px 48px;
    color: var(--text-main);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition-normal);
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-input:hover {
    border-color: var(--border);
    background: var(--bg-white);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px var(--glow-soft);
}

.form-input:focus~.input-icon {
    color: var(--primary);
}

.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
.form-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-cream) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
    caret-color: var(--text-main);
}

.form-input:-webkit-autofill:focus {
    -webkit-box-shadow:
        0 0 0 1000px var(--bg-white) inset,
        0 0 0 4px var(--glow-soft) !important;
    border-color: var(--primary) !important;
}

.form-input:-moz-autofill,
.form-input:-moz-autofill:hover,
.form-input:-moz-autofill:focus {
    background-color: var(--bg-cream) !important;
    color: var(--text-main) !important;
}

.form-input:autofill,
.form-input:autofill:hover,
.form-input:autofill:focus {
    background-color: var(--bg-cream) !important;
    color: var(--text-main) !important;
}

.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    border-radius: var(--radius-sm);
}

.password-toggle:hover {
    color: var(--primary);
    background: var(--glow-soft);
}

.btn-login {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary) 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: var(--radius-md);
    padding: 16px 24px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-normal);
    box-shadow: 0 8px 25px -5px var(--glow-primary);
    margin-top: 10px;
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.25) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px -5px var(--glow-primary);
    background-position: 100% 0;
}

.btn-login:hover::before {
    transform: translateX(100%);
}

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

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-login i {
    transition: transform var(--transition-fast);
}

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

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

.btn-login.loading .btn-text {
    opacity: 0;
}

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

.btn-spinner {
    display: none;
    position: absolute;
}

.login-footer {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.login-footer p {
    color: var(--text-light);
    font-size: 13px;
    font-weight: 400;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.login-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.form-input:focus-visible,
.password-toggle:focus-visible,
.btn-login:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .login-wrapper {
        grid-template-columns: 1fr;
        max-width: 450px;
        min-height: auto;
    }

    .login-branding {
        padding: 40px 30px;
    }

    .branding-icon {
        width: 80px;
        height: 80px;
        font-size: 36px;
        margin-bottom: 20px;
    }

    .branding-title {
        font-size: 26px;
    }

    .branding-features {
        display: none;
    }

    .login-card {
        padding: 40px 30px;
    }
}

@media (max-width: 480px) {
    .login-wrapper {
        margin: 10px;
        border-radius: var(--radius-lg);
    }

    .login-branding {
        padding: 30px 20px;
    }

    .branding-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }

    .branding-title {
        font-size: 22px;
    }

    .branding-subtitle {
        font-size: 14px;
    }

    .login-card {
        padding: 30px 20px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .form-input {
        padding: 14px 14px 14px 44px;
    }

    .btn-login {
        padding: 14px 20px;
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes success-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.success-pulse {
    animation: success-pulse 0.6s ease;
}

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out forwards;
    min-width: 300px;
    border-left: 4px solid #3b82f6;
    
}

.toast.success {
    border-left-color: #22c55e;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast i {
    font-size: 20px;
}

.toast.success i {
    color: #22c55e;
}

.toast.error i {
    color: #ef4444;
}

.toast.warning i {
    color: #f59e0b;
}

.toast.info i {
    color: #3b82f6;
}

.toast span {
    color: #374151;
    font-size: 0.95rem;
    font-weight: 500;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}