:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --primary-dark: #1d4ed8;
    --accent: #06b6d4;
    --accent-light: #cffafe;
    --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #f0f9ff 50%, #ecfeff 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(255, 255, 255, 0.6);
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --input-bg: #f8fafc;
    --input-border: #e2e8f0;
    --input-focus-border: #2563eb;
    --input-focus-shadow: rgba(37, 99, 235, 0.1);
    --input-text: #1e293b;
    --btn-bg: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    --btn-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.4);
    --btn-hover-shadow: 0 15px 25px -5px rgba(37, 99, 235, 0.5);
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --error-text: #dc2626;
    --circle-1: rgba(37, 99, 235, 0.2);
    --circle-2: rgba(6, 182, 212, 0.15);
    --circle-3: rgba(99, 102, 241, 0.12);
}

html, body {
    height: 100vh;
    margin: 0;
    padding: 0;
    font-family: 'Prompt', 'Sarabun', sans-serif;
    background: var(--bg-gradient);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.bg-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.circle-deco {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: float 20s ease-in-out infinite;
}

.circle-1 {
    width: 500px;
    height: 500px;
    background: var(--circle-1);
    top: -150px;
    right: -100px;
}

.circle-2 {
    width: 400px;
    height: 400px;
    background: var(--circle-2);
    bottom: -100px;
    left: -100px;
    animation-delay: -6s;
}

.circle-3 {
    width: 300px;
    height: 300px;
    background: var(--circle-3);
    top: 20%;
    left: 50%;
    animation-delay: -12s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.1); }
    66% { transform: translate(-20px, 30px) scale(0.95); }
}

.login-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

#login-form {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 48px 40px 40px;
    box-shadow: var(--card-shadow);
    text-align: center;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.2);
}

.form-header {
    margin-bottom: 32px;
}

.header-icon {
    display: flex;
    justify-content: center;
}

.header-icon img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    padding: 10px;
    background: #ffffff;
    box-shadow: 0 0 30px rgba(37, 99, 235, 0.15);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.header-icon img:hover {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 0 40px rgba(37, 99, 235, 0.25);
}

.project-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.project-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    letter-spacing: 0.5px;
}

.form-group {
    margin-bottom: 22px;
    position: relative;
    text-align: left;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    z-index: 2;
    pointer-events: none;
    transition: color 0.3s ease;
}

.form-control:focus ~ .input-icon {
    color: var(--primary);
}

.form-control {
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    color: var(--input-text);
    padding: 14px 16px 14px 48px;
    height: 52px;
    width: 100%;
    border-radius: 14px;
    font-size: 1rem;
    font-family: 'Prompt', 'Sarabun', sans-serif;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-control::placeholder {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-control:focus {
    background: #ffffff;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 4px var(--input-focus-shadow);
    outline: none;
}

.form-control.is-invalid {
    border-color: var(--error-text);
    background: #fff5f5;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    z-index: 2;
    transition: color 0.3s ease;
    background: none;
    border: none;
    padding: 4px;
    line-height: 1;
}

.toggle-password:hover {
    color: var(--primary);
}

.btn-login {
    background: var(--btn-bg);
    border: none;
    border-radius: 14px;
    padding: 16px 25px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Prompt', 'Sarabun', sans-serif;
    color: #ffffff;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--btn-shadow);
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--btn-hover-shadow);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-loader {
    font-size: 1.3rem;
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 0.9rem;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    animation: shake 0.5s ease;
}

.alert-error i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 20px;
}

@media (max-width: 480px) {
    .login-box {
        padding: 36px 24px 32px;
        border-radius: 20px;
    }

    .header-icon img {
        width: 80px;
        height: 80px;
        padding: 8px;
    }

    .project-title {
        font-size: 1.1rem;
    }

    .form-control {
        height: 48px;
        padding: 12px 14px 12px 42px;
        font-size: 0.95rem;
    }

    .btn-login {
        padding: 14px 20px;
        font-size: 1rem;
        min-height: 50px;
    }
}
