/* Authentication Modal Styles - Premium Redesign */
/* Implements Glassmorphism and Material 3 Principles */

:root {
    --auth-glass-bg: rgba(255, 255, 255, 0.7);
    --auth-glass-border: rgba(255, 255, 255, 0.4);
    --auth-radius: 28px;
    --auth-shadow: 0 24px 48px rgba(0, 0, 0, 0.1);
    --auth-primary-gradient: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
    --auth-input-bg: rgba(241, 243, 244, 0.5);
}

/* Modal Overlay */
.auth-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(32, 33, 36, 0.4);
    z-index: 10002;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.auth-modal-overlay.active {
    display: block;
    animation: authFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal Container */
.auth-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--auth-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--auth-glass-border);
    border-radius: var(--auth-radius);
    width: 90%;
    max-width: 460px;
    z-index: 10003;
    box-shadow: var(--auth-shadow);
    overflow: hidden;
    /* Allow scrolling on small screens */
    max-height: 92vh;
    overflow-y: auto;
}

.auth-modal.active {
    display: block;
    animation: authModalEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-modal-content {
    padding: 36px 40px 32px;
    position: relative;
}

/* Close Button */
.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--google-grey-700);
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    z-index: 10;
    border: none;
}

.close-modal:hover {
    background-color: rgba(60, 64, 67, 0.1);
    color: var(--google-grey-900);
    transform: rotate(90deg);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    padding: 4px;
    margin-bottom: 28px;
    position: relative;
}

.auth-tab {
    flex: 1;
    padding: 11px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--google-grey-700);
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.auth-tab.active {
    color: white;
    background: var(--auth-primary-gradient);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.2);
}

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

.auth-form-container.active {
    display: block;
    animation: authFormSlide 0.4s cubic-bezier(0.2, 0, 0.1, 1);
}

.auth-form h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--google-grey-900);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.auth-form > p {
    color: var(--google-grey-700);
    margin-bottom: 24px;
    font-size: 14px;
}

/* =============================================
   SOCIAL SIGN-IN BUTTONS
============================================= */

.auth-social-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.auth-social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 8px;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    color: #3c4043;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.auth-social-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.2s;
}

.auth-social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.15);
}

.auth-social-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.auth-social-btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.auth-social-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Google */
.auth-social-google {
    color: #3c4043;
    background: #fff;
}

.auth-social-google:hover {
    background: #f8f9fa;
    border-color: #dadce0;
}

/* GitHub */
.auth-social-github {
    color: #24292e;
    background: #fff;
}

.auth-social-github:hover {
    background: #f6f8fa;
    border-color: #d0d7de;
}

.auth-social-github .auth-social-icon {
    fill: #24292e;
}

/* Apple */
.auth-social-apple {
    color: #1d1d1f;
    background: #fff;
}

.auth-social-apple:hover {
    background: #f5f5f5;
    border-color: #c7c7cc;
}

.auth-social-apple .auth-social-icon {
    fill: #1d1d1f;
}

/* LinkedIn */
.auth-social-linkedin {
    color: #0A66C2;
    background: #fff;
}

.auth-social-linkedin:hover {
    background: #f0f6ff;
    border-color: #0A66C2;
}

.auth-social-linkedin .auth-social-icon {
    fill: #0A66C2;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    color: #9aa0a6;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #dadce0, transparent);
}

/* Inputs */
.auth-form-group {
    margin-bottom: 16px;
}

.auth-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--google-grey-700);
    margin-bottom: 8px;
    margin-left: 2px;
}

.auth-form-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--auth-input-bg);
    border: 2px solid transparent;
    border-radius: 14px;
    font-size: 15px;
    color: var(--google-grey-900);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    font-family: inherit;
}

.auth-form-input:focus {
    outline: none;
    background: white;
    border-color: #1a73e8;
    box-shadow: 0 4px 20px rgba(26, 115, 232, 0.08);
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 15px;
    background: var(--auth-primary-gradient);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 8px;
    box-shadow: 0 8px 16px rgba(26, 115, 232, 0.2);
    font-family: inherit;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
}

.auth-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(26, 115, 232, 0.3);
}

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

.auth-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

/* Spinner inside button */
.auth-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}

/* Navigation Links */
.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--google-grey-700);
}

.auth-switch a {
    color: #1a73e8;
    font-weight: 700;
    text-decoration: none;
    margin-left: 4px;
}

.auth-forgot-password {
    text-align: center;
    margin-top: 14px;
}

.auth-forgot-link {
    font-size: 13px;
    color: var(--google-grey-600);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-forgot-link:hover {
    color: #1a73e8;
}

/* Error Messages */
.auth-error-message {
    background: rgba(217, 48, 37, 0.08);
    color: #d93025;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: none;
    border: 1px solid rgba(217, 48, 37, 0.15);
    gap: 8px;
    align-items: center;
}

.auth-error-message.active,
.auth-error-message[style*="display: flex"] {
    display: flex;
    animation: authShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Success Messages */
.auth-success-message {
    background: rgba(30, 142, 62, 0.08);
    color: #1e8e3e;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: none;
    border: 1px solid rgba(30, 142, 62, 0.15);
    gap: 8px;
    align-items: center;
}

.auth-success-message.active,
.auth-success-message[style*="display: flex"] {
    display: flex;
    animation: authFadeIn 0.4s ease;
}

/* Helper Text */
.auth-helper-text {
    display: block;
    font-size: 11px;
    color: var(--google-grey-600);
    margin-top: 6px;
    margin-left: 4px;
    font-style: italic;
}


/* Animations */
@keyframes authFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes authModalEnter {
    from {
        opacity: 0;
        transform: translate(-50%, -45%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

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

@keyframes authShake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

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

/* Toast System (Material 3 style) */
.auth-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #323336;
    color: white;
    padding: 14px 24px;
    border-radius: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 20001;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.auth-toast.active {
    transform: translateX(-50%) translateY(0);
}

.auth-toast.success i { color: #81c995; }
.auth-toast.error i { color: #f28b82; }

/* Mobile Adaptations */
@media (max-width: 480px) {
    .auth-modal {
        width: 100%;
        border-radius: 28px 28px 0 0;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        max-height: 92dvh;
        max-height: 92vh;
    }

    .auth-modal.active {
        animation: authModalEnterMobile 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
    }

    .auth-modal-content {
        padding: 24px 20px calc(28px + env(safe-area-inset-bottom, 0px));
    }

    .auth-social-buttons {
        gap: 8px;
    }

    .auth-social-btn {
        padding: 11px 6px;
        font-size: 12px;
        gap: 6px;
        border-radius: 12px;
    }

    .auth-social-icon {
        width: 16px;
        height: 16px;
    }

    .auth-form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .premium-auth-card {
        padding: 32px 20px;
        width: 92%;
        max-width: 360px;
        border-radius: 24px;
    }
}

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

/* Auth Wall Overlay */
/* Layering (2026-11-05): above the workshop modal (10000), below the
   auth overlay/modal (10002/10003), so the login wall is always on top. */
.premium-auth-wall {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(32, 33, 36, 0.25);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.premium-auth-wall.active {
    display: flex;
}

.premium-auth-card {
    background: white;
    border-radius: 28px;
    padding: 48px 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.premium-auth-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 12px 24px rgba(26, 115, 232, 0.25);
}

.premium-auth-icon span {
    font-size: 32px;
}

.premium-auth-title {
    font-size: 24px;
    font-weight: 800;
    color: #202124;
    margin-bottom: 12px;
}

.premium-auth-subtitle {
    color: #5f6368;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 32px;
}

.premium-auth-btn {
    background: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 16px rgba(26, 115, 232, 0.2);
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.premium-auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(26, 115, 232, 0.3);
}

/* Auth Wall blur on content */
.auth-wall-blurred {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s;
}