* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Animated gradient background */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #F37021 0%, #FF8C42 50%, #F37021 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
    z-index: -2;
}

/* Pattern overlay */
body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../picture/bg-main.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3;
    z-index: -1;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Glassmorphism container */
.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 45px 40px;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    text-align: center;
    width: 100%;
    max-width: 440px;
    animation: fadeInUp 0.6s ease-out;
    position: relative;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo styling */
.logo {
    width: 140px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 2px 8px rgba(243, 112, 33, 0.2));
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

/* Welcome heading */
.login-container h2 {
    color: #1a1a1a;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 30px;
    letter-spacing: -0.5px;
}

/* Tab navigation */
.login-tabs {
    display: flex;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 4px;
    position: relative;
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.tab-button.active {
    color: #fff;
    background: linear-gradient(135deg, #F37021 0%, #FF8C42 100%);
    box-shadow: 0 4px 12px rgba(243, 112, 33, 0.3);
}

.tab-button:hover:not(.active) {
    color: #F37021;
    background: rgba(243, 112, 33, 0.08);
}

/* Tab content */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Form styling */
.login-form {
    margin-top: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    padding-left: 4px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus {
    outline: none;
    border-color: #F37021;
    box-shadow: 0 0 0 4px rgba(243, 112, 33, 0.1);
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* Submit button */
.login-form input[type="submit"] {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    background: linear-gradient(135deg, #F37021 0%, #FF8C42 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(243, 112, 33, 0.3);
    letter-spacing: 0.3px;
}

.login-form input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(243, 112, 33, 0.4);
}

.login-form input[type="submit"]:active {
    transform: translateY(0);
}

/* Guest mode link */
.guest-mode {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: #6b7280;
}

.guest-mode a {
    color: #F37021;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
}

.guest-mode a:hover {
    color: #d8540b;
    text-decoration: underline;
}

/* Alert styling */
.alert-danger {
    margin-top: 20px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    border-left: 4px solid #dc2626;
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* QR Code section */
.qr-container {
    text-align: center;
    padding: 20px 0;
}

.qr-container p {
    font-size: 15px;
    color: #4b5563;
    margin-bottom: 16px;
    font-weight: 500;
}

.qr-code {
    max-width: 220px;
    max-height: 220px;
    margin: 20px auto;
    border: 3px solid #e5e7eb;
    border-radius: 16px;
    padding: 12px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.qr-code:hover {
    transform: scale(1.02);
}

.qr-status {
    margin-top: 20px;
    font-size: 14px;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #F37021;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Retry button in QR section */
.qr-container button,
.qr-status button {
    background: linear-gradient(135deg, #F37021 0%, #FF8C42 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-top: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(243, 112, 33, 0.3);
}

.qr-container button:hover,
.qr-status button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(243, 112, 33, 0.4);
}

#qr-error {
    color: #dc2626;
    font-weight: 500;
}

#qr-error p {
    color: #dc2626;
    margin-bottom: 12px;
}

/* Loading overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid #f3f4f6;
    border-top: 5px solid #F37021;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

.loading-overlay-content p {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* Disabled and readonly state for form inputs */
.form-group input:disabled,
.form-group input:read-only,
.form-group input[readonly] {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Prevent interaction when form is submitting */
.form-submitting {
    pointer-events: none;
}

.form-submitting input {
    cursor: not-allowed;
}

.login-form input[type="submit"]:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.login-form input[type="submit"]:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Responsive design */
@media (max-width: 480px) {
    .login-container {
        margin: 20px;
        padding: 35px 25px;
    }

    .login-container h2 {
        font-size: 22px;
    }

    .tab-button {
        font-size: 14px;
        padding: 10px 16px;
    }

    .loading-overlay-content {
        padding: 30px 40px;
    }

    .loading-spinner {
        width: 40px;
        height: 40px;
    }
}