/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1d1d1f;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f7 50%, #e8e8ed 100%);
    min-height: 100vh;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(248, 248, 248, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-logo a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo {
    height: 96px;
    width: auto;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

.logo:hover {
    transform: scale(1.08);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.logo-text {
    font-size: 2rem;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: -0.04em;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    background: linear-gradient(135deg, #007AFF, #5856D6, #AF52DE);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: logoTextShimmer 4s ease-in-out infinite, logoTextFloat 6s ease-in-out infinite 0.5s;
    position: relative;
}

@keyframes logoTextShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes logoTextFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-2px); }
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: #1d1d1f;
    font-weight: 400;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    opacity: 0.8;
}

.nav-link:hover {
    color: #007AFF;
    opacity: 1;
    transform: translateY(-1px);
}

/* Language Selector */
.language-selector {
    display: flex;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.lang-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1d1d1f;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.lang-btn.active {
    background: linear-gradient(135deg, #007AFF, #5856D6);
    color: white;
}

.lang-btn:hover:not(.active) {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
}

/* Main Auth Layout */
.auth-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 120px;
    padding-bottom: 2rem;
}

.auth-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    min-height: calc(100vh - 140px);
}

/* Auth Branding */
.auth-branding {
    background: linear-gradient(135deg, #007AFF, #5856D6, #AF52DE);
    border-radius: 24px;
    padding: 3rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.auth-branding::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="%23ffffff" fill-opacity="0.1"><polygon points="36 34 25 25 14 34 0 20 0 30 14 44 25 35 36 44 50 30 50 20"/></g></g></svg>');
    opacity: 0.1;
}

.branding-content {
    position: relative;
    z-index: 2;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.brand-logo-img {
    height: 64px;
    width: auto;
    filter: brightness(0) invert(1);
}

.brand-logo h1 {
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: -0.04em;
}

.auth-branding h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.auth-branding p {
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.feature-icon {
    font-size: 1.5rem;
}

.auth-benefits {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.benefit-icon {
    font-size: 2rem;
    width: 50px;
    text-align: center;
}

.benefit-text h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.benefit-text p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Auth Form Container */
.auth-form-container {
    background: white;
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-header h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.form-header p {
    color: #86868b;
    font-size: 1rem;
}

/* Form Styles */
.auth-form {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: inherit;
    background: #ffffff;
}

.form-group input:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: #ff3b30;
}

.password-input {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #86868b;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.password-toggle:hover {
    color: #007AFF;
    background: rgba(0, 122, 255, 0.1);
}

.password-strength {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.password-strength.weak {
    color: #ff3b30;
}

.password-strength.medium {
    color: #ff9500;
}

.password-strength.strong {
    color: #30d158;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #1d1d1f;
}

.checkbox-container input[type="checkbox"] {
    width: auto;
    margin: 0;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.checkbox-container input[type="checkbox"]:checked {
    background: #007AFF;
    border-color: #007AFF;
}

.checkbox-container input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.terms-link {
    color: #007AFF;
    text-decoration: none;
    font-weight: 500;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
}

.terms-link:hover {
    color: #0056CC;
    text-decoration: underline;
}

.forgot-link {
    color: #007AFF;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.forgot-link:hover {
    color: #0056CC;
    text-decoration: underline;
}

/* Auth Buttons */
.auth-button {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: none;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-button.primary {
    background: linear-gradient(135deg, #007AFF, #5856D6);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.25);
}

.auth-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.35);
    background: linear-gradient(135deg, #0056CC, #4C44CC);
}

.auth-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-loader {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.loader-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); }
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 2rem 0;
    color: #86868b;
    font-size: 0.9rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
    margin: 0 1rem;
}

/* Social Auth */
.social-auth {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.social-button {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    color: #1d1d1f;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.social-button:hover {
    border-color: #007AFF;
    background: #f0f9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.social-button.google:hover {
    border-color: #4285F4;
    background: #f8faff;
}

.social-button.github:hover {
    border-color: #24292e;
    background: #f6f8fa;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.auth-footer p {
    color: #86868b;
    margin-bottom: 0.5rem;
}

.auth-link {
    color: #007AFF;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.auth-link:hover {
    color: #0056CC;
    text-decoration: underline;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 120px;
    right: 2rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #30d158;
    min-width: 300px;
    animation: slideInRight 0.3s ease-out;
}

.toast.error {
    border-left-color: #ff3b30;
}

.toast.warning {
    border-left-color: #ff9500;
}

.toast.info {
    border-left-color: #007AFF;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #007AFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-content p {
    color: #1d1d1f;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .auth-container {
        grid-template-columns: 1fr;
        gap: 3rem;
        max-width: 500px;
    }
    
    .auth-branding {
        order: 2;
        padding: 2rem;
    }
    
    .auth-form-container {
        order: 1;
        padding: 2rem;
    }
}

/* iPad specific navigation adjustments */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .nav-container {
        padding: 0.75rem 1.5rem;
    }
    
    .logo {
        height: 72px;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
    
    .nav-menu {
        gap: 1.5rem;
    }
    
    .nav-link {
        font-size: 0.9rem;
    }
    
    .language-selector {
        margin: 0 0.5rem;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 1rem;
    }
    
    .logo {
        height: 64px;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 1rem;
    }
    
    .auth-main {
        padding-top: 140px;
    }
    
    .auth-container {
        padding: 0 1rem;
        gap: 2rem;
    }
    
    .auth-branding,
    .auth-form-container {
        padding: 2rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .social-auth {
        flex-direction: column;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 0 1rem;
    }
    
    .auth-branding,
    .auth-form-container {
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .brand-logo h1 {
        font-size: 2rem;
    }
    
    .auth-branding h2 {
        font-size: 1.5rem;
    }
    
    .form-header h2 {
        font-size: 1.5rem;
    }
}

/* Focus states for accessibility */
button:focus,
input:focus,
a:focus {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
}

/* Animations */
.auth-form-container {
    animation: slideInUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.auth-branding {
    animation: slideInUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s both;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}