:root {
    --primary: #1f7a3a;
    --primary-dark: #16a34a;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --input-focus: #22c55e;
    --input-bg: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 2rem;
    animation: fadeIn 0.8s ease-out;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo {
    margin-bottom: 1.5rem;
    display: block;
}

.logo img {
    max-width: 120px;
    height: auto;
    object-fit: contain;
}

h1 {
    font-size: 1.85rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 2.5rem;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 20px 25px -5px rgba(0, 0, 0, 0.05);
}

.toggle-container {
    display: flex;
    background: #f1f5f9;
    padding: 0.35rem;
    border-radius: 0.85rem;
    margin-bottom: 2rem;
}

.toggle-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.75rem;
    border-radius: 0.65rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-btn.active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    margin-left: 0.25rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper svg {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.input-wrapper input {
    width: 100%;
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    border-radius: 0.85rem;
    padding: 0.875rem 1rem 0.875rem 3rem;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
}

.input-wrapper input:focus+svg,
.input-wrapper input:not(:placeholder-shown)+svg {
    color: var(--primary);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -0.5rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.2s;
    background: #fff;
}

.checkbox-container:hover .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked+.checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-container input:checked+.checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.forgot-link:hover {
    text-decoration: underline;
}

.submit-btn {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0.85rem;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.3);
}

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

.submit-btn.success {
    background: #10b981 !important;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

#qr-section {
    text-align: center;
    animation: fadeIn 0.4s ease;
}

.qr-placeholder {
    width: 180px;
    height: 180px;
    margin: 0 auto 1.5rem;
    background: #f8fafc;
    border: 1.5px dashed var(--border);
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: var(--primary);
}

.qr-scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--primary), transparent);
    animation: scan 2.5s ease-in-out infinite;
}

@keyframes scan {

    0%,
    100% {
        top: 0;
    }

    50% {
        top: 100%;
    }
}

.qr-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.secondary-btn {
    background: #fff;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.65rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: #f1f5f9;
    color: var(--text);
    border-color: var(--text-muted);
}

.app-footer {
    text-align: center;
    margin-top: 3rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.app-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.hidden {
    display: none;
}

.form-message {
    margin: 0 0 1.25rem;
    padding: 0.9rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.45;
}

.success-message {
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.error-message {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.72;
    transform: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

/* Loading Spinner for button */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.w-full {
    width: 100%;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1.5px solid var(--border);
}

.divider span {
    padding: 0 1rem;
    font-weight: 500;
}

.back-link {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

@media (max-width: 480px) {
    .login-container {
        padding: 1rem;
    }

    .login-card {
        padding: 1.75rem;
    }
}
