:root {
    /* Warmer Light Theme */
    --auth-bg: #FDFCF8;
    /* Warm Ivory */
    --auth-card-bg: #FFFFFF;
    --auth-text: #3E3C38;
    /* Warm Charcoal */
    --auth-border: rgba(60, 60, 50, 0.12);
    --auth-input-bg: #F7F5F0;
    /* Warm Cream */
    --auth-input-border: rgba(60, 60, 50, 0.15);
    --accent-color: #2E7D32;
    /* Warm Forest Green */
    --accent-hover: #1B5E20;
    --text-muted: #6B6960;
    /* Warm Grey */
    --shadow: 0 4px 20px rgba(60, 60, 50, 0.08);
}

html.dark-mode body,
body.dark-mode {
    --auth-bg: #1C1C1A;
    /* Warm Black */
    --auth-card-bg: #252523;
    /* Dark Warm Grey */
    --auth-text: #EAE8E3;
    /* Warm White */
    --auth-border: rgba(234, 232, 227, 0.1);
    --auth-input-bg: #141412;
    --auth-input-border: rgba(234, 232, 227, 0.15);
    --accent-color: #4ade80;
    /* Brighter green for dark mode availability */
    --accent-hover: #22c55e;
    --text-muted: #A8A6A0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.auth-page {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--auth-text);
    transition: background 0.3s;
}

.auth-container {
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 40px;
    width: 100%;
    max-width: 360px;
    /* Slightly narrower for cleaner look */
    text-align: center;
    position: relative;
    z-index: 10;
    transition: background 0.3s, border-color 0.3s;
}

.auth-header h1 {
    margin: 0 0 10px;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--auth-text);
}

.auth-header p {
    margin: 0 0 30px;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    text-align: left;
    position: relative;
    /* For absolute error positioning */
}

/* ... label ... */

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--auth-text);
}

.form-group input,
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--auth-input-border);
    background: var(--auth-input-bg);
    color: var(--auth-text);
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
    /* Green glow */
    background: var(--auth-card-bg);
}

/* Error State */
.form-group input.error {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
    color: #ef4444;
}

.input-error-msg {
    color: #ef4444;
    font-size: 0.75rem;
    position: absolute;
    top: 0;
    right: 0;
    /* Align to right for auth form */
    font-weight: 500;
    animation: fadeIn 0.2s ease-out;
}

.auth-btn {
    background: var(--accent-color);
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.auth-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.auth-footer {
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-inline-action {
    text-align: right;
    margin-top: -6px;
}

.auth-link-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

.auth-link-btn:hover {
    text-decoration: underline;
}

.error-message {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
    margin-bottom: 15px;
    text-align: left;
}

.success-message {
    color: #15803d;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.35);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
    margin-bottom: 15px;
    text-align: left;
}

body.dark-mode .success-message,
html.dark-mode body .success-message {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.22);
    border-color: rgba(74, 222, 128, 0.4);
}

.reset-section {
    margin-top: 4px;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-border);
    color: var(--auth-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    background: var(--auth-input-bg);
}

/* Background Decoration - subtle clean shapes */
.bg-circle {
    display: none;
    /* Removed for cleaner look requested */
}

/* Invite Code Input Styles */
.invite-code-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.invite-code-input {
    width: 44px;
    height: 52px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid var(--auth-input-border);
    border-radius: 8px;
    background: var(--auth-input-bg);
    color: var(--auth-text);
    transition: all 0.2s;
    outline: none;
    font-family: 'Inter', monospace;
}

.invite-code-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
    background: var(--auth-card-bg);
}

.invite-code-input.error {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
    animation: shake 0.3s ease-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

/* Agreement Checkboxes */
.agreement-group {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group .checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    position: relative;
    text-align: left;
}

/* Custom Checkbox Styling */
.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Create a custom checkbox */
.checkmark {
    position: relative;
    display: block;
    flex-shrink: 0;
    height: 20px;
    width: 20px;
    min-width: 20px;
    background-color: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* On mouse-over, add a grey background color */
.checkbox-label:hover input~.checkmark {
    background-color: var(--auth-input-border);
}

/* When the checkbox is checked, add a blue background */
.checkbox-label input:checked~.checkmark {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    transform: scale(1.1);
    animation: bounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounce {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

/* Show the checkmark when checked */
.checkbox-label input:checked~.checkmark:after {
    display: block;
}

/* Style the checkmark/indicator */
.checkbox-label .checkmark:after {
    left: 7px;
    top: 3px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Focus styles for accessibility */
/* Focus styles removed as per user request */
/* .checkbox-label input:focus~.checkmark {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
    border-color: var(--accent-color);
} */

.checkbox-label input[type="checkbox"].error~.checkmark {
    border-color: #ef4444;
    animation: shake 0.3s ease-in-out;
}

.checkbox-label .agreement-text {
    display: inline;
}

.checkbox-label a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.agreement-group .input-error-msg {
    position: relative;
    top: auto;
    right: auto;
    margin-top: 4px;
}
