/* Tufte-inspired typography and layout */
body {
    font-family: "Palatino", "Palatino Linotype", "Georgia", serif;
    line-height: 1.6;
    color: #333;
    background-color: #fffef7;
    margin: 0;
    padding: 0;
    font-size: 18px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header with subtle hierarchy */
header {
    padding: 3rem 0 2rem;
    border-bottom: 1px solid #ddd;
    margin-bottom: 3rem;
}

.lab-title {
    font-size: 2.5rem;
    font-weight: normal;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.institution {
    font-size: 1.1rem;
    color: #666;
    font-style: italic;
    margin: 0 0 1rem 0;
}

.location {
    font-size: 1rem;
    color: #888;
    margin: 0;
}

/* Main content area */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.auth-container {
    background: #fafafa;
    border: 1px solid #eee;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 450px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: normal;
    margin: 0 0 2rem 0;
    text-align: center;
    color: #444;
}

/* Tab navigation */
.tabs {
    display: flex;
    margin-bottom: 2rem;
    background: #f0f0f0;
    border-radius: 4px;
    padding: 2px;
}

.tab {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.95rem;
    color: #666;
}

.tab.active {
    background: #fff;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab:not(.active):hover {
    background: #e8e8e8;
}

/* Form styles */
.form-container {
    display: none;
}

.form-container.active {
    display: block;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #444;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #fff;
}

.form-group input:focus {
    outline: none;
    border-color: #888;
    box-shadow: 0 0 0 2px rgba(136, 136, 136, 0.1);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
    font-family: inherit;
}

.submit-btn:hover {
    background: #555;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: #999;
}

/* Alert messages */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: 600;
    display: none;
    font-size: 0.95rem;
}

.alert.success {
    background: #e8f5e8;
    color: #2d5a2d;
    border: 1px solid #b8e6b8;
}

.alert.error {
    background: #fce8e8;
    color: #a52a2a;
    border: 1px solid #f5b2b2;
}

/* User profile section */
.user-profile {
    display: none;
    text-align: center;
}

.user-profile.active {
    display: block;
}

.user-avatar {
    width: 80px;
    height: 80px;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: #fff;
    font-weight: bold;
}

.user-info {
    background: #f8f8f8;
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    border: 1px solid #eee;
}

.user-info h3 {
    color: #444;
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: normal;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e8e8e8;
}

.info-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-label {
    font-weight: 600;
    color: #666;
    font-size: 0.95rem;
}

.info-value {
    color: #444;
    font-family: "Monaco", "Menlo", "Consolas", monospace;
    font-size: 0.9rem;
}

.logout-btn {
    width: 100%;
    padding: 0.75rem;
    background: #a52a2a;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.logout-btn:hover {
    background: #8b2323;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

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

/* Footer */
footer {
    margin-top: 2rem;
    padding: 2rem 0;
    border-top: 1px solid #ddd;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

footer a {
    color: #666;
    text-decoration: none;
}

footer a:hover {
    color: #333;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .lab-title {
        font-size: 2rem;
    }

    .auth-container {
        padding: 2rem;
    }

    .main-content {
        padding: 1rem 0;
    }
}

/* Fade in animation */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease-in forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}/* Enhanced Mobile CSS for Auth Page */

@media (max-width: 480px) {
    /* Extra small devices (phones) */
    .container {
        padding: 0 0.75rem;
    }
    
    .lab-title {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .institution {
        font-size: 1rem;
    }
    
    .location {
        font-size: 0.9rem;
    }
    
    .auth-container {
        padding: 1.5rem;
        margin: 0;
        border-radius: 6px;
    }
    
    .auth-title {
        font-size: 1.3rem;
        margin-bottom: 1.5rem;
    }
    
    .tabs {
        margin-bottom: 1.5rem;
    }
    
    .tab {
        padding: 0.6rem 0.5rem;
        font-size: 0.9rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-group input {
        padding: 0.875rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
        box-sizing: border-box;
    }
    
    .submit-btn {
        padding: 1rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .logout-btn {
        padding: 0.875rem;
        min-height: 44px;
    }
    
    .user-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .user-info {
        padding: 1.25rem;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .info-label {
        font-size: 0.9rem;
    }
    
    .info-value {
        font-size: 0.85rem;
        word-break: break-all;
    }
    
    header {
        padding: 2rem 0 1.5rem;
        margin-bottom: 2rem;
    }
    
    footer {
        padding: 1.5rem 0;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    /* Tablet and mobile improvements */
    .main-content {
        align-items: flex-start;
        padding: 1.5rem 0;
    }
    
    .auth-container {
        margin-top: 1rem;
        box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    }
    
    /* Better touch targets */
    .tab {
        min-height: 44px;
        transition: background-color 0.2s ease;
    }
    
    .tab:active {
        background: #d0d0d0;
    }
    
    .submit-btn:active {
        transform: translateY(0);
        background: #444;
    }
    
    .logout-btn:active {
        transform: translateY(0);
        background: #901f1f;
    }
    
    /* Improved form layout */
    .form-group input {
        border-width: 1.5px;
    }
    
    .form-group input:focus {
        border-width: 2px;
        transform: none;
    }
    
    /* Alert improvements */
    .alert {
        font-size: 0.9rem;
        padding: 0.875rem;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .tab:hover {
        background: transparent;
    }
    
    .tab:not(.active):active {
        background: #d8d8d8;
    }
    
    .submit-btn:hover {
        transform: none;
        box-shadow: none;
        background: #333;
    }
    
    .logout-btn:hover {
        transform: none;
        box-shadow: none;
        background: #a52a2a;
    }
    
    .form-group input:focus {
        box-shadow: 0 0 0 3px rgba(136, 136, 136, 0.15);
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        padding: 1rem 0;
    }
    
    header {
        padding: 1.5rem 0 1rem;
        margin-bottom: 1.5rem;
    }
    
    .auth-container {
        margin-top: 0.5rem;
        padding: 1.5rem;
    }
    
    .lab-title {
        font-size: 1.8rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .auth-container {
        border-width: 2px;
        border-color: #000;
    }
    
    .form-group input {
        border-width: 2px;
        border-color: #333;
    }
    
    .form-group input:focus {
        border-color: #000;
        box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .tab,
    .submit-btn,
    .logout-btn,
    .form-group input,
    .fade-in {
        transition: none;
        animation: none;
    }
    
    .loading {
        animation: none;
        border-top-color: #ffffff;
    }
}