:root {
    --primary: #6c5dd3;
    --secondary: #9f92ec;
    --accent: #ff8a65;
    --success: #34c38f;
    --info: #4dabf7;
    --warning: #f1b44c;
    --danger: #ef5362;
    --dark: #1a1727;
    --darker: #13111d;
    --light-bg: #23202f;
    --card-bg: #282535;
    --border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #a9a9b7;
}

/* Global Styles */
body {
    font-family: 'Sukhumvit Set', 'Prompt', sans-serif;
    background: linear-gradient(180deg, var(--dark) 0%, var(--light-bg) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--darker);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Animation Effects */
@keyframes glow {
    0% {
        box-shadow: 0 0 4px rgba(108, 93, 211, 0.4);
    }

    50% {
        box-shadow: 0 0 12px rgba(108, 93, 211, 0.6);
        /* Slightly stronger for desktop */
    }

    100% {
        box-shadow: 0 0 4px rgba(108, 93, 211, 0.4);
    }
}

.glowing {
    animation: glow 2s infinite;
}

/* Login Container */
.login-container {
    max-width: 492px;
    /* Increased for desktop */
    width: 100%;
    margin: auto;
}

/* Card Styling */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    /* Softer radius */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.card-header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.card-header h3 {
    margin: 0;
    font-size: clamp(22px, 5vw, 28px);
    /* Larger for desktop */
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 40px;
    /* More spacious */
}

/* Form Styling */
.form-control {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: #ffffff; /* เปลี่ยนสีตัวหนังสือเป็นขาว */
    padding: 14px 20px;
    font-size: clamp(15px, 4vw, 18px);
    transition: all 0.3s;
    height: 52px;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(108, 93, 211, 0.25);
    border-color: var(--primary);
    color: #ffffff; /* ยังคงสีขาวเมื่อ focus */
    outline: none;
}

.form-control::placeholder {
    color: var(--text-secondary); /* คงสี placeholder เป็นสีรองตามเดิม */
}

.form-label {
    color: var(--text-primary);
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 500;
    margin-bottom: 10px;
}

.input-group-text {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: clamp(15px, 4vw, 18px);
    padding: 0 14px;
}

/* Button Styling */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: 10px;
    padding: 14px;
    font-weight: 600;
    width: 100%;
    font-size: clamp(15px, 4vw, 18px);
    height: 52px;
    /* Larger for desktop */
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--secondary);
    border-color: var(--secondary);
    transform: translateY(-2px);
    /* Subtle lift effect */
}

/* Checkbox Styling */
.form-check-input {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    width: 22px;
    /* Larger for desktop */
    height: 22px;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-label {
    color: var(--text-secondary);
    font-size: clamp(13px, 3.5vw, 15px);
    margin-left: 10px;
}

/* Links */
.forgot-password {
    color: var(--primary);
    text-decoration: none;
    font-size: clamp(13px, 3.5vw, 15px);
    display: block;
    text-align: right;
    margin-top: 12px;
    transition: all 0.3s ease;
}

.forgot-password:hover {
    color: var(--secondary);
    text-decoration: underline;
}

/* Logo Styling */
.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    font-size: clamp(32px, 8vw, 40px);
    /* Larger for desktop */
    color: var(--primary);
    margin-right: 12px;
}

.logo-text {
    font-size: clamp(24px, 6vw, 32px);
    /* Larger for desktop */
    font-weight: 700;
    background: linear-gradient(45deg, #ffffff, #9f92ec);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.logo-text small {
    font-size: clamp(12px, 3vw, 14px);
    display: block;
    font-weight: 400;
    opacity: 0.8;
    margin-top: -5px;
}

/* Neon Effects */
.neon-border {
    border: 1px solid rgba(108, 93, 211, 0.3);
    box-shadow: 0 0 8px rgba(108, 93, 211, 0.4),
        inset 0 0 8px rgba(108, 93, 211, 0.15);
}

/* Validation Styling */
.is-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 83, 98, 0.25) !important;
}

.invalid-feedback {
    display: none;
    color: var(--danger);
    font-size: clamp(12px, 3vw, 14px);
    margin-top: 5px;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .login-container {
        max-width: 90%;
        padding: 0 20px;
    }

    .card-body {
        padding: 25px;
    }

    .card-header {
        padding: 20px;
    }

    .logo-text small {
        display: none;
        /* Hide subtitle on tablets */
    }

    .form-control,
    .btn-primary {
        height: 48px;
        font-size: clamp(14px, 4vw, 16px);
    }

    .input-group-text {
        padding: 0 12px;
    }

    .form-check-input {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 576px) {
    .login-container {
        max-width: 100%;
        padding: 0 15px;
    }

    .card {
        border-radius: 12px;
    }

    .card-body {
        padding: 20px;
    }

    .card-header {
        padding: 15px;
    }

    .form-control,
    .btn-primary {
        height: 44px;
        font-size: clamp(13px, 4vw, 15px);
    }

    .input-group-text {
        padding: 0 10px;
    }

    .form-check-input {
        width: 18px;
        height: 18px;
    }

    .glowing {
        animation: none;
        /* Disable animation for mobile performance */
    }
}

@media (max-width: 360px) {
    .card {
        border-radius: 10px;
    }

    .card-header {
        padding: 12px;
    }

    .logo {
        font-size: 28px;
    }

    .logo-text {
        font-size: 22px;
    }

    .form-label,
    .form-check-label,
    .forgot-password {
        font-size: 12px;
    }

    .form-control,
    .btn-primary {
        font-size: 12px;
        height: 40px;
    }
}

.form-check {
    margin-bottom: 0;
}

.form-check-input {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.1rem rgba(13, 110, 253, 0.25);
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.5);
}

.form-check-label {
    color: #6c757d;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.forgot-password {
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.alert {
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}