/* Modern CSS for AVC Registration Form */
:root {
    --primary-color: #660000;
    --primary-light: #8B0000;
    --secondary-color: #F5F5F5;
    --accent-color: #D4AF37;
    --text-dark: #333;
    --text-light: #666;
    --border-color: #E1E5E9;
    --success-color: #28A745;
    --error-color: #DC3545;
    --warning-color: #FFC107;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--secondary-color) 0%, #E8E8E8 100%);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Header and Navigation */
#backgroundbody {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    height: 120px;
    position: relative;
}

#navigation {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    height: 120px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

#navigation::before {
    content: "Alexander Valley Cellars";
    color: white;
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header-logo {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    height: 60px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

/* Adjust text positioning when logo is present */
#navigation {
    padding-left: 220px;
}

#menubar {
    background: var(--primary-color);
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Main Content */
#content {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.content-header {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    text-align: center;
}

.content-header h1 {
    color: var(--primary-color);
    margin: 0 0 1rem 0;
    font-size: 2rem;
    font-weight: 300;
}

.content-header p {
    color: var(--text-light);
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.7;
}

/* Error Messages */
.err {
    background: #F8D7DA;
    border: 1px solid #F5C6CB;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 1rem 0;
    list-style: none;
}

.err li {
    color: var(--error-color);
    margin: 0.5rem 0;
    font-weight: 500;
}

/* Form Styling */
.cmxform {
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
}

fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

legend {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--secondary-color);
    width: 100%;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group label.required::after {
    content: " *";
    color: var(--error-color);
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 0, 0, 0.1);
    transform: translateY(-1px);
}

.form-group input:invalid {
    border-color: var(--error-color);
}

.form-group input:valid {
    border-color: var(--success-color);
}

/* Username checking indicator */
#user-result {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    min-height: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#user-result img {
    width: 16px;
    height: 16px;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Submit button */
.submit-container {
    text-align: center;
    margin-top: 2rem;
}

.submit {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    background: linear-gradient(135deg, var(--primary-light) 0%, #A00000 100%);
}

.submit:active {
    transform: translateY(0);
}

.submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Success/Error states */
.success-message {
    background: #D4EDDA;
    border: 1px solid #C3E6CB;
    color: #155724;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.error-message {
    background: #F8D7DA;
    border: 1px solid #F5C6CB;
    color: #721C24;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

/* Password strength indicator */
.password-strength {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.strength-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.strength-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-weak { background: var(--error-color); width: 25%; }
.strength-fair { background: var(--warning-color); width: 50%; }
.strength-good { background: #17A2B8; width: 75%; }
.strength-strong { background: var(--success-color); width: 100%; }

/* Responsive Design */
@media (max-width: 768px) {
    #content {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .cmxform {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }
    
    .content-header {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .content-header h1 {
        font-size: 1.5rem;
    }
    
    legend {
        font-size: 1.25rem;
    }
    
        #navigation::before {
            font-size: 1.5rem;
        }
        .header-logo {
            height: 40px;
            left: 10px;
        }
        #navigation {
            padding-left: 180px;
        }
}

@media (max-width: 480px) {
    .form-group input {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    .submit {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }
}

/* Animation for form validation */
.form-group input.error {
    border-color: var(--error-color);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Focus visible for accessibility */
.form-group input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .cmxform {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .submit {
        display: none;
    }
}
