* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #007AFF;
    --primary-purple: #5856D6;
    --dark-blue: #1d1d1f;
    --light-gray: #f5f5f7;
    --medium-gray: #86868b;
    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.25);
    --success-green: #34C759;
    --error-red: #FF3B30;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Floating Background Elements */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.float-element {
    position: absolute;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 50%;
    animation: float 25s infinite linear;
}

.float-element:nth-child(1) { width: 100px; height: 100px; top: 10%; left: 20%; animation-delay: 0s; }
.float-element:nth-child(2) { width: 60px; height: 60px; top: 70%; left: 80%; animation-delay: 8s; }
.float-element:nth-child(3) { width: 80px; height: 80px; top: 50%; left: 10%; animation-delay: 16s; }
.float-element:nth-child(4) { width: 120px; height: 120px; top: 20%; left: 70%; animation-delay: 24s; }

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); opacity: 0.7; }
    50% { transform: translateY(-100px) rotate(180deg); opacity: 1; }
    100% { transform: translateY(0px) rotate(360deg); opacity: 0.7; }
}

/* Page Selector */
.page-selector {
    position: relative;
    margin: 120px auto 40px auto;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 8px;
    display: flex;
    gap: 8px;
    z-index: 100;
    width: auto;
    min-width: 300px;
}

.page-btn {
    padding: 8px 16px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

.page-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.page-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Main Container */
.container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px 60px; /* Reduced top padding since page selector is now in flow */
    min-height: calc(100vh - 200px); /* Account for navbar and footer */
}

.page {
    display: none;
    animation: fadeInScale 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.page.active {
    display: block;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Login/Register Forms */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 32px;
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.auth-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.25);
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-blue);
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--medium-gray);
    font-size: 16px;
}

/* Form Styles */
.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-blue);
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    color: var(--dark-blue);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.form-input.error {
    border-color: var(--error-red);
    box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.1);
}

.form-input.success {
    border-color: var(--success-green);
    box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.1);
}

.error-message {
    color: var(--error-red);
    font-size: 12px;
    margin-top: 6px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Buttons */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    color: white;
    padding: 16px 24px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.3);
    margin-bottom: 16px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 122, 255, 0.4);
}

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

.btn-secondary {
    width: 100%;
    background: rgba(0, 0, 0, 0.05);
    color: var(--dark-blue);
    padding: 16px 24px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 16px;
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Social Login */
.social-login {
    margin: 32px 0;
}

.divider {
    text-align: center;
    position: relative;
    margin: 24px 0;
    color: var(--medium-gray);
    font-size: 14px;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.divider span {
    background: rgba(255, 255, 255, 0.95);
    padding: 0 16px;
    position: relative;
    z-index: 2;
}

.social-buttons {
    display: flex;
    gap: 12px;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--dark-blue);
}

.social-btn:hover {
    background: rgba(0, 0, 0, 0.02);
    transform: translateY(-1px);
}

/* Links */
.auth-links {
    text-align: center;
    margin-top: 24px;
}

.auth-links a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.auth-links a:hover {
    color: var(--primary-purple);
}

/* Remember & Forgot */
.form-extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 14px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-blue);
}

/* Loading State */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.message {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    display: none;
}

.message.success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success-green);
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.message.error {
    background: rgba(255, 59, 48, 0.1);
    color: var(--error-red);
    border: 1px solid rgba(255, 59, 48, 0.2);
}

.message.show {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .auth-card {
        padding: 32px 24px;
        margin: 0 16px;
    }
    
    .page-selector {
        left: 20px;
        right: 20px;
        transform: none;
        max-width: calc(100% - 40px);
        margin: 100px auto 20px auto; /* Adjust margin for mobile */
    }
    
    .container {
        padding: 10px 10px 40px; /* Reduce padding for mobile */
    }
}

/* Animations */
.slide-in {
    animation: slideIn 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
