/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #ffffff;
    background: linear-gradient(135deg, #0a0b1e 0%, #1a1b2e 50%, #0a0b1e 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Auth Container */
.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 212, 170, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 53, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Auth Header */
.auth-header {
    padding: 24px 32px;
    position: relative;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #00d4aa 0%, #00b894 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 20px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

/* Auth Content */
.auth-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0 32px 32px;
    position: relative;
    z-index: 10;
    padding-top: 0;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: linear-gradient(135deg, rgba(26, 27, 46, 0.9) 0%, rgba(37, 38, 64, 0.9) 100%);
    border: 1px solid rgba(51, 51, 68, 0.4);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    background: rgba(51, 51, 68, 0.3);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 32px;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    color: #a0a0a0;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.auth-tab.active {
    background: #00d4aa;
    color: #0a0b1e;
}

/* Auth Forms */
.auth-form {
    display: none;
}

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

.form-title {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    text-align: center;
}

.form-subtitle {
    color: #a0a0a0;
    text-align: center;
    margin-bottom: 32px;
    font-size: 16px;
}

/* Form Elements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 16px;
    color: #a0a0a0;
    font-size: 16px;
    z-index: 2;
}

.input-wrapper input {
    width: 100%;
    background: rgba(51, 51, 68, 0.4);
    border: 1px solid rgba(51, 51, 68, 0.6);
    border-radius: 12px;
    padding: 16px 16px 16px 48px;
    color: #ffffff;
    font-size: 16px;
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: #00d4aa;
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
    background: rgba(51, 51, 68, 0.6);
}

.input-wrapper input::placeholder {
    color: #6c6c80;
}

.password-toggle {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    font-size: 16px;
    z-index: 2;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: #00d4aa;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 8px;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.strength-fill {
    height: 100%;
    width: 0%;
    background: #dc3545;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.strength-text {
    font-size: 12px;
    color: #a0a0a0;
    font-weight: 500;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    color: #a0a0a0;
    gap: 8px;
    line-height: 1.4;
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: rgba(51, 51, 68, 0.4);
    border: 1px solid rgba(51, 51, 68, 0.6);
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
    background: #00d4aa;
    border-color: #00d4aa;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.forgot-password,
.terms-link,
.privacy-link {
    color: #00d4aa;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.forgot-password:hover,
.terms-link:hover,
.privacy-link:hover {
    color: #00b894;
    text-decoration: underline;
}

/* Error Messages */
.input-wrapper.error input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: block;
    opacity: 0;
    animation: fadeInError 0.3s ease forwards;
}

.error-message.show {
    opacity: 1;
}

@keyframes fadeInError {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Auth Message Container */
#auth-message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.auth-message {
    padding: 16px 24px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.4s ease;
}

.auth-message.success {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: #28a745;
}

.auth-message.error {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #dc3545;
}

.auth-message.info {
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.3);
    color: #00d4aa;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #00d4aa 0%, #00b894 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 170, 0.4);
}

.btn-social {
    background: rgba(51, 51, 68, 0.4);
    color: #ffffff;
    border: 1px solid rgba(51, 51, 68, 0.6);
    margin-bottom: 12px;
}

.btn-social:hover {
    border-color: #00d4aa;
    background: rgba(51, 51, 68, 0.6);
    transform: translateY(-1px);
}

.btn-social.google:hover {
    border-color: #4285f4;
}

.btn-social.facebook:hover {
    border-color: #1877f2;
}

/* Social Login */
.social-login {
    display: flex;
    gap: 12px;
    margin: 24px 0;
}

.divider {
    position: relative;
    text-align: center;
    margin: 24px 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(51, 51, 68, 0.4);
}

.divider span {
    background: linear-gradient(135deg, rgba(26, 27, 46, 0.9) 0%, rgba(37, 38, 64, 0.9) 100%);
    color: #a0a0a0;
    padding: 0 16px;
    font-size: 14px;
    position: relative;
}

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

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: 32px;
    color: #6c6c80;
    font-size: 14px;
}

/* Success Overlay */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.success-overlay.active {
    display: flex;
}

.success-card {
    background: linear-gradient(135deg, #1a1b2e 0%, #252640 100%);
    border: 1px solid rgba(51, 51, 68, 0.4);
    border-radius: 20px;
    padding: 48px;
    text-align: center;
    max-width: 400px;
    animation: successSlideIn 0.5s ease-out;
}

@keyframes successSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.success-icon {
    width: 80px;
    height: 80px;
    background: rgba(40, 167, 69, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 40px;
    color: #28a745;
}

.success-card h3 {
    font-size: 24px;
    color: #ffffff;
    margin-bottom: 12px;
}

.success-card p {
    color: #a0a0a0;
    margin-bottom: 24px;
}

.loading-spinner {
    display: flex;
    justify-content: center;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 212, 170, 0.3);
    border-top: 3px solid #00d4aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .auth-container {
        padding: 20px 16px;
        min-height: 100vh;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .auth-card {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 24px 20px;
        border-radius: 16px;
        box-sizing: border-box;
    }

    .form-row {
        flex-direction: column;
        gap: 16px;
        width: 100%;
    }

    .form-row .form-group {
        width: 100%;
        box-sizing: border-box;
    }

    .btn {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        box-sizing: border-box;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: 8px;
        touch-action: manipulation;
    }

    .auth-tabs {
        gap: 8px;
        width: 100%;
        display: flex;
    }

    .auth-tab {
        flex: 1;
        padding: 12px 16px;
        font-size: 14px;
        box-sizing: border-box;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .form-title {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .form-subtitle {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .input-wrapper {
        padding: 12px 16px;
        width: 100%;
        box-sizing: border-box;
        position: relative;
    }

    .input-wrapper input {
        font-size: 16px; /* Prevents zoom on iOS */
        width: 100%;
        box-sizing: border-box;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border: none;
        background: transparent;
        outline: none;
    }

    .password-toggle {
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: #a0a0a0;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        padding: 8px;
    }

    .checkbox-wrapper {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
        box-sizing: border-box;
        touch-action: manipulation;
    }

    .checkbox-wrapper input[type="checkbox"] {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        margin: 0;
    }

    .checkbox-wrapper span {
        font-size: 13px;
        line-height: 1.4;
        flex: 1;
    }

    .password-strength {
        margin-top: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .auth-footer {
        margin-top: 32px;
        font-size: 12px;
    }

    /* Form specific mobile fixes */
    .auth-form {
        width: 100%;
        box-sizing: border-box;
    }

    .form-group {
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 16px;
    }

    .form-group label {
        display: block;
        margin-bottom: 8px;
        width: 100%;
    }

    .form-options {
        width: 100%;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin: 16px 0;
    }

    /* Mobile Safari specific fixes */
    input[type="email"],
    input[type="password"],
    input[type="text"],
    input[type="tel"] {
        -webkit-appearance: none;
        -webkit-border-radius: 0;
        border-radius: 8px;
    }

    /* Prevent zoom on input focus */
    input, select, textarea {
        font-size: 16px !important;
    }

    /* Touch improvements */
    button, input, select, textarea {
        touch-action: manipulation;
    }

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-header {
        padding: 12px 16px;
    }

    .logo-text {
        font-size: 20px;
    }

    .auth-card {
        padding: 20px;
    }

    .form-title {
        font-size: 24px;
    }

    .form-subtitle {
        font-size: 14px;
    }

    .input-wrapper input {
        padding: 14px 14px 14px 44px;
        font-size: 15px;
    }

    .btn {
        padding: 12px 18px;
        font-size: 15px;
    }

    .auth-tab {
        padding: 10px 12px;
        font-size: 14px;
    }

    .auth-content {
        padding: 0 16px 16px;
    }
}

/* Animation */
.form-group {
    animation: slideUp 0.3s ease-out;
}

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

/* Focus States */
.input-wrapper input:focus + .password-toggle {
    color: #00d4aa;
}

/* Error States */
.input-wrapper.error input {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

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