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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

@media (min-width: 768px) {
    .background-animation {
        animation: floatBackground 30s ease-in-out infinite;
    }
    
    @keyframes floatBackground {
        0%, 100% {
            transform: scale(1) rotate(0deg);
        }
        33% {
            transform: scale(1.05) rotate(2deg);
        }
        66% {
            transform: scale(0.95) rotate(-2deg);
        }
    }
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    transition: opacity 0.5s ease;
}

[data-theme="light"] .gradient-orb {
    opacity: 0.1;
    filter: blur(120px);
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    top: -200px;
    left: -200px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    bottom: -200px;
    right: -200px;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Auth Container */
.auth-container {
    width: 100%;
    max-width: 420px;
    margin: auto;
    animation: slideUp 0.6s ease-out;
}

/* Auth Wrapper - Desktop Layout */
.auth-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-xl);
}

[data-theme="light"] .auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Logo Section */
.logo-section {
    text-align: center;
    margin-bottom: 32px;
}

.logo-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* Desktop Features - Hidden on Mobile */
.desktop-features {
    display: none;
}

.logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
}

.logo svg {
    width: 100%;
    height: 100%;
}

.app-title {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #f093fb 50%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.tagline {
    color: var(--text-tertiary);
    font-size: 14px;
    font-weight: 400;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-hover);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
    position: relative;
}

/* Tab indicator */
.tabs::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 6px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 
        0 4px 15px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tabs.register-active::before {
    transform: translateX(calc(100% + 4px));
}

.tab-button {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-tertiary);
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.tab-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: all 0.6s ease;
    border-radius: 50%;
}

.tab-button:hover::before {
    width: 120%;
    height: 120%;
}


.tab-button:hover {
    color: var(--text-secondary);
    transform: translateY(-1px);
}

.tab-button:active {
    transform: translateY(0) scale(0.98);
}

.tab-button.active {
    color: var(--text-primary);
    font-weight: 600;
    transform: scale(1);
}

.tab-button.active::after {
    display: none;
}

/* Tab button text animation */
.tab-button span {
    display: inline-block;
    transition: transform 0.2s ease;
}

.tab-button:hover span {
    transform: translateY(-1px);
}

/* Form Styles */
.tab-content {
    animation: fadeIn 0.4s ease;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Desktop only - internal scrolling */
@media (min-width: 768px) {
    .tab-content {
        max-height: calc(100vh - 350px);
        overflow-y: auto;
    }
}

.tab-content.hidden {
    display: none;
}

/* Custom scrollbar for tab content */
.tab-content::-webkit-scrollbar {
    width: 6px;
}

.tab-content::-webkit-scrollbar-track {
    background: var(--bg-hover);
    border-radius: 3px;
}

.tab-content::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}

.tab-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-2);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 4px;
}

/* Input Groups */
.input-group {
    position: relative;
    margin-bottom: 0;
    margin-top: 0;
    overflow: visible;
    min-height: 48px; /* Ensure minimum height for icon placement */
}

.input-group input {
    width: 100%;
    padding: 16px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group input:hover {
    border-color: var(--border-hover);
}

.input-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-hover);
}

/* Error States */
.input-group.error input {
    border-color: var(--error);
    background: var(--error-bg);
    animation: shake 0.5s ease-in-out;
}

.input-group.error label {
    color: var(--error);
    opacity: 1;
}

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

.input-group.error .error-message {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Success States */
.input-group.success input {
    border-color: var(--success);
    background: var(--success-bg);
    padding-right: 44px; /* Make room for checkmark */
    position: relative; /* Ensure input is positioning context */
}

.input-group.success label {
    color: var(--success);
    opacity: 1;
}

/* Success Checkmark */
.input-group .success-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-group.success .success-icon {
    opacity: 1;
    animation: successBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.success-icon svg {
    width: 100%;
    height: 100%;
}

.success-icon circle {
    fill: var(--success);
    stroke: none;
}

.success-icon path {
    fill: none;
    stroke: white;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 22;
    stroke-dashoffset: 22;
    animation: checkmarkDraw 0.4s ease-out 0.2s forwards;
}

@keyframes successBounce {
    0% {
        transform: translateY(-50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translateY(-50%) scale(1.1);
    }
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

@keyframes checkmarkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

/* Sparkle effect for success */
.input-group.success::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 40px;
    width: 4px;
    height: 4px;
    background: var(--success);
    border-radius: 50%;
    transform: translateY(-50%);
    opacity: 0;
    animation: sparkle 1.5s ease-out 0.4s;
    z-index: 2;
}

@keyframes sparkle {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0);
    }
    20% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    40% {
        opacity: 1;
        transform: translateY(-50%) translateX(-8px) scale(0.5);
    }
    60% {
        opacity: 1;
        transform: translateY(-50%) translateX(8px) scale(0.5);
    }
    80%, 100% {
        opacity: 0;
        transform: translateY(-50%) translateY(-10px) scale(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

.input-group label {
    position: absolute;
    left: 0;
    top: -24px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    line-height: 1;
    padding: 2px 0;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    opacity: 1;
}

.input-group input:focus + label {
    color: var(--primary-2);
}

/* Username input - force lowercase */
#register-username {
    text-transform: lowercase;
}

.input-highlight {
    display: none;
}

/* Options */
.options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    padding-left: 28px;
}

.checkbox-container input {
    opacity: 0;
    position: absolute;
}

.checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--bg-hover);
    border: 1px solid var(--border-hover);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.checkbox-container input:checked ~ .checkmark {
    background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
    border-color: transparent;
}

.checkmark::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.3s ease;
}

.checkbox-container input:checked ~ .checkmark::after {
    transform: rotate(45deg) scale(1);
}

.checkbox-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.forgot-link {
    color: var(--primary-2);
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.3s ease;
}

.forgot-link:hover {
    opacity: 0.8;
}

/* Submit Button */
.submit-btn {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 4px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

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

.btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.submit-btn.loading .btn-text {
    display: none;
}

.submit-btn.loading .btn-loader {
    display: block;
}

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


/* Footer */
.footer {
    text-align: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-default);
    animation: fadeIn 0.6s ease-out 0.3s both;
}

.footer p {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.2px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.footer p:hover {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 20px;
        align-items: flex-start;
        min-height: auto;
    }
    
    .auth-container {
        margin-top: 20px;
        margin-bottom: 20px;
    }
    
    /* Add safe area padding for devices with notches/home bars */
    .container {
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }
    
    .auth-card {
        padding: 24px;
    }
    
    /* Remove height restrictions on mobile */
    .tab-content {
        max-height: none;
        overflow-y: visible;
    }
    
    .app-title {
        font-size: 28px;
    }
    
    .gradient-orb {
        filter: blur(100px);
    }
    
    .orb-1 {
        width: 400px;
        height: 400px;
    }
    
    .orb-2 {
        width: 350px;
        height: 350px;
    }
    
    .orb-3 {
        width: 300px;
        height: 300px;
    }
    
    .tab-button {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    
    .input-group input {
        font-size: 15px;
        padding: 16px;
    }
    
    .input-group.success input {
        padding-right: 40px; /* Ensure room for checkmark on mobile */
    }
    
    .input-group {
        margin-bottom: 24px;
    }
    
    .input-group label {
        font-size: 11px;
        top: -22px;
    }
    
    .submit-btn {
        padding: 14px;
        font-size: 15px;
    }
}

/* Desktop Layout - 768px and up */
@media (min-width: 768px) {
    .auth-container {
        max-width: 1200px;
        padding: 0 40px;
    }
    
    .auth-wrapper {
        flex-direction: row;
        gap: 60px;
        align-items: center;
        min-height: 600px;
        background: var(--bg-secondary);
        border: 1px solid var(--border-default);
        border-radius: 32px;
        padding: 60px;
        box-shadow: var(--shadow-xl);
    }
    
    [data-theme="light"] .auth-wrapper {
        background: var(--bg-secondary);
        box-shadow: 
            0 20px 40px rgba(0, 0, 0, 0.06),
            inset 0 1px 0 rgba(255, 255, 255, 0.9);
    }
    
    /* Logo Section - Left Side on Desktop */
    .logo-section {
        flex: 1;
        margin-bottom: 0;
        text-align: left;
        padding-right: 40px;
        border-right: 1px solid var(--border-default);
    }
    
    .logo-content {
        align-items: flex-start;
        gap: 32px;
    }
    
    .logo {
        width: 80px;
        height: 80px;
    }
    
    .app-title {
        font-size: 48px;
    }
    
    .tagline {
        font-size: 18px;
        color: var(--text-secondary);
    }
    
    /* Desktop Features - Visible on Desktop */
    .desktop-features {
        display: flex;
        flex-direction: column;
        gap: 24px;
        margin-top: 32px;
    }
    
    .feature-item {
        display: flex;
        align-items: center;
        gap: 16px;
        opacity: 0;
        animation: fadeInLeft 0.6s ease-out forwards;
    }
    
    .feature-item:nth-child(1) {
        animation-delay: 0.2s;
    }
    
    .feature-item:nth-child(2) {
        animation-delay: 0.3s;
    }
    
    .feature-item:nth-child(3) {
        animation-delay: 0.4s;
    }
    
    @keyframes fadeInLeft {
        from {
            opacity: 0;
            transform: translateX(-20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    .feature-icon {
        font-size: 24px;
        width: 48px;
        height: 48px;
        background: var(--bg-hover);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .feature-item p {
        font-size: 16px;
        font-weight: 500;
        color: var(--text-primary);
        margin: 0;
    }
    
    /* Auth Card - Right Side on Desktop */
    .auth-card {
        flex: 1;
        max-width: 480px;
        background: var(--bg-secondary);
        box-shadow: var(--shadow-md);
        border: 1px solid var(--border-default);
        border-radius: 24px;
        padding: 40px;
    }
    
    /* Adjust tab content height for desktop */
    .tab-content {
        max-height: calc(100vh - 400px);
    }
    
    /* Footer adjustments for desktop */
    .footer {
        margin-top: 40px;
        padding-top: 30px;
        font-size: 14px;
    }
}

/* Larger Desktop - 1024px and up */
@media (min-width: 1024px) {
    .auth-wrapper {
        gap: 80px;
        padding: 80px;
    }
    
    .logo-section {
        padding-right: 60px;
    }
}

/* Extra Large Desktop - 1440px and up */
@media (min-width: 1440px) {
    .auth-container {
        max-width: 1400px;
    }
    
    .auth-wrapper {
        gap: 120px;
        padding: 100px;
    }
    
    .app-title {
        font-size: 56px;
    }
    
    .tagline {
        font-size: 20px;
    }
}