/* Mobile-First Passwordless Auth - Purple, Black & White Theme */

:root {
    --primary-purple: #9333ea;
    --dark-purple: #7e22ce;
    --light-purple: #a855f7;
    --black: #0a0a0a;
    --dark-gray: #1a1a1a;
    --medium-gray: #2a2a2a;
    --white: #ffffff;
    --off-white: #f5f5f5;
    --text-gray: #a3a3a3;
}

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

/* Mobile-first base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    background: var(--black);
    color: var(--white);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    position: relative;
    overflow-x: hidden;
}

/* Animated background gradient */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 50%, rgba(147, 51, 234, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 40% 20%, rgba(126, 34, 206, 0.1) 0%, transparent 50%);
    animation: gradientMove 20s ease infinite;
    z-index: 0;
}

@keyframes gradientMove {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(5%, 5%) rotate(120deg); }
    66% { transform: translate(-5%, 5%) rotate(240deg); }
}

.auth-container {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    animation: fadeIn 0.5s ease-out;
}

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

/* Glassmorphism Card - Mobile First */
.auth-card {
    background: rgba(26, 26, 26, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 24px;
    border: 1px solid rgba(147, 51, 234, 0.2);
    box-shadow: 0 8px 32px 0 rgba(147, 51, 234, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 32px 24px;
    transition: all 0.3s ease;
}

/* Logo */
.auth-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--primary-purple), var(--light-purple));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--white);
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
}

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

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-gray);
    font-weight: 400;
}

/* SSO Buttons Section */
.sso-section {
    margin-bottom: 24px;
}

.sso-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.sso-btn-full {
    width: 100%;
    padding: 16px 24px;
    background: var(--dark-gray);
    border: 1px solid rgba(147, 51, 234, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
}

.sso-btn-full i {
    font-size: 20px;
}

.sso-btn-full:hover {
    background: var(--medium-gray);
    border-color: var(--primary-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

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

/* Legacy grid support (if needed) */
.sso-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.sso-btn {
    padding: 16px;
    background: var(--dark-gray);
    border: 1px solid rgba(147, 51, 234, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--white);
}

.sso-btn:hover {
    background: var(--medium-gray);
    border-color: var(--primary-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

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

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(147, 51, 234, 0.2);
}

.divider span {
    padding: 0 16px;
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 500;
}

/* Email Option Toggle */
.email-toggle {
    text-align: center;
    margin-bottom: 20px;
}

.toggle-btn {
    background: var(--dark-gray);
    border: 1px solid rgba(147, 51, 234, 0.3);
    color: var(--white);
    padding: 14px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.toggle-btn:hover {
    background: var(--primary-purple);
    border-color: var(--primary-purple);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4);
}

.toggle-btn i {
    font-size: 16px;
}

/* Step Container */
.step-container {
    display: none;
    animation: slideIn 0.4s ease-out;
}

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

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

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

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

.form-input {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    background: var(--dark-gray);
    border: 1px solid rgba(147, 51, 234, 0.2);
    border-radius: 12px;
    color: var(--white);
    transition: all 0.3s ease;
}

.form-input::placeholder {
    color: var(--text-gray);
}

.form-input:focus {
    outline: none;
    background: var(--medium-gray);
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--white);
    -webkit-box-shadow: 0 0 0px 1000px var(--dark-gray) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary-purple), var(--light-purple));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(147, 51, 234, 0.4);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    width: 100%;
    padding: 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--white);
    background: var(--dark-gray);
    border: 1px solid rgba(147, 51, 234, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: var(--medium-gray);
    border-color: var(--primary-purple);
}

/* Alert Messages */
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: rgba(147, 51, 234, 0.1);
    color: var(--light-purple);
    border-color: rgba(147, 51, 234, 0.3);
}

.alert-icon {
    font-size: 16px;
}

/* Footer Links */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-gray);
}

.auth-link {
    color: var(--primary-purple);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.auth-link:hover {
    color: var(--light-purple);
    text-decoration: underline;
}

.page-footer {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 0;
}

.page-footer a {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.page-footer a:hover {
    color: var(--primary-purple);
}

/* Loading State */
.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin-left: -9px;
    margin-top: -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spinner 0.8s linear infinite;
}

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

/* Password Strength */
.password-strength {
    margin-top: 8px;
    height: 3px;
    background: var(--dark-gray);
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-weak {
    width: 33%;
    background: #ef4444;
}

.strength-medium {
    width: 66%;
    background: #f59e0b;
}

.strength-strong {
    width: 100%;
    background: var(--primary-purple);
}

.password-hint {
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 6px;
}

/* Hide/Show utility classes */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Tablet and up (min-width: 480px) */
@media (min-width: 480px) {
    body {
        padding: 24px;
    }

    .auth-card {
        padding: 40px 32px;
    }

    .auth-title {
        font-size: 32px;
    }

    .auth-subtitle {
        font-size: 15px;
    }

    .sso-buttons {
        gap: 14px;
    }

    .sso-btn-full {
        padding: 18px 28px;
        font-size: 16px;
    }

    .sso-btn-full i {
        font-size: 22px;
    }

    .sso-grid {
        gap: 10px;
    }

    .sso-btn {
        padding: 18px;
        font-size: 22px;
    }

    .form-input {
        padding: 18px;
        font-size: 16px;
    }

    .btn-primary {
        padding: 18px;
        font-size: 16px;
    }

    .btn-secondary {
        padding: 16px;
        font-size: 15px;
    }
}

/* Desktop (min-width: 768px) */
@media (min-width: 768px) {
    .auth-container {
        max-width: 440px;
    }

    .auth-card {
        padding: 48px 40px;
    }

    .auth-logo {
        width: 64px;
        height: 64px;
        font-size: 32px;
    }

    .sso-buttons {
        gap: 16px;
    }

    .sso-btn-full {
        padding: 20px 32px;
    }

    .sso-grid {
        gap: 12px;
    }

    .toggle-btn {
        width: auto;
        padding: 14px 32px;
    }
}

/* Large desktop (min-width: 1024px) */
@media (min-width: 1024px) {
    .auth-card:hover {
        box-shadow: 0 12px 40px 0 rgba(147, 51, 234, 0.3),
                    0 0 0 1px rgba(255, 255, 255, 0.1);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .auth-card {
        border: 2px solid var(--primary-purple);
    }

    .form-input {
        border: 2px solid var(--primary-purple);
    }

    .btn-primary {
        border: 2px solid var(--white);
    }
}

/* App Selection Styles */
.app-selection {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.app-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--dark-gray);
    border: 1px solid rgba(147, 51, 234, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--white);
}

.app-card:hover {
    background: var(--medium-gray);
    border-color: var(--primary-purple);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.app-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--secondary-purple) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.app-info {
    flex: 1;
    min-width: 0;
}

.app-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
    margin: 0 0 4px 0;
}

.app-url {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-arrow {
    font-size: 18px;
    color: var(--text-gray);
    transition: all 0.3s ease;
}

.app-card:hover .app-arrow {
    color: var(--primary-purple);
    transform: translateX(4px);
}

.app-selection-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.logout-link {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.logout-link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.05);
}

/* Responsive app selection */
@media (min-width: 768px) {
    .app-card {
        padding: 20px;
    }

    .app-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }

    .app-name {
        font-size: 18px;
    }

    .app-url {
        font-size: 14px;
    }
}

/* Account Info Styles */
.account-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-label i {
    font-size: 14px;
}

.info-value {
    font-size: 16px;
    color: var(--white);
    margin: 0;
    padding: 12px 16px;
    background: var(--dark-gray);
    border: 1px solid rgba(147, 51, 234, 0.2);
    border-radius: 8px;
}

.provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--secondary-purple) 100%);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

.account-actions {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
    width: 100%;
    padding: 14px 24px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    transform: translateY(-2px);
}

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

/* Responsive account info */
@media (min-width: 768px) {
    .info-value {
        font-size: 17px;
        padding: 14px 18px;
    }

    .btn-logout {
        padding: 16px 28px;
        font-size: 16px;
    }
}
