/**
 * Workshopr Auth Modal Styles
 * Standalone CSS for auth modal - can be included on any subdomain
 *
 * Usage:
 * <link rel="stylesheet" href="https://www.workshopr.io/assets/css/auth-modal.css">
 */

/* CSS Variables - mapped from platform tokens with fallbacks for standalone use */
:root {
    --ws-primary-red: var(--mainsite-primary, #E54D4D);
    --ws-primary-red-dark: var(--mainsite-dark, #C73E3E);
    --ws-text-dark: var(--color-ink, #2C2416);
    --ws-text-gray: var(--color-ink-muted, #78716C);
    --ws-bg-white: var(--bg-surface, #ffffff);
    --ws-bg-light: var(--bg-muted, #F5F5F4);
    --ws-border-light: var(--gray-200, #E7E5E4);
    --ws-radius: var(--radius-lg, 8px);
}

/* Auth Modal Overlay */
.ws-auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ws-auth-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wsAuthFadeIn 0.2s ease;
}

@keyframes wsAuthFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Modal Content Container */
.ws-auth-modal-content {
    background: var(--ws-bg-white);
    border-radius: var(--radius-2xl, 16px);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl, 0 20px 60px rgba(0, 0, 0, 0.3));
    animation: wsAuthSlideUp 0.3s ease;
}

/* Modal Header */
.ws-auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--ws-primary-red) 0%, var(--ws-primary-red-dark) 100%);
}

.ws-auth-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.ws-auth-close-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md, 6px);
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ws-auth-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: rotate(90deg);
}

.ws-auth-close-btn:active {
    transform: rotate(90deg) scale(0.9);
}

/* Modal Body */
.ws-auth-body {
    padding: 14px 24px 16px;
}

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

.ws-auth-form.active {
    display: block;
    animation: wsAuthFadeIn 0.2s ease;
}

/* Form Groups */
.ws-form-group {
    margin-bottom: 4px;
}

.ws-form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ws-text-dark);
    margin-bottom: 3px;
}

.ws-form-group input {
    width: 100%;
    padding: 9px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--ws-border-light);
    border-radius: var(--ws-radius);
    font-family: inherit;
    transition: all 0.15s;
    background: var(--ws-bg-white);
    box-sizing: border-box;
}

.ws-form-group input:focus {
    outline: none;
    border-color: var(--ws-primary-red);
    box-shadow: 0 0 0 3px var(--phase-learn-light, rgba(229, 77, 77, 0.1));
}

.ws-form-group input.error {
    border-color: var(--ws-primary-red);
    box-shadow: 0 0 0 3px var(--phase-learn-light, rgba(229, 77, 77, 0.1));
}

.ws-form-error {
    display: none;
    font-size: 0.8rem;
    color: var(--ws-primary-red);
    margin-top: 6px;
}

.ws-form-error.visible {
    display: block;
}

/* Password Field with Toggle */
.ws-password-field {
    position: relative;
}

.ws-password-field input {
    padding-right: 44px;
}

.ws-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--ws-text-gray);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.ws-password-toggle:hover {
    color: var(--ws-text-dark);
}

/* Form Options Row */
.ws-form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 0.8rem;
}

.ws-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ws-text-gray);
    cursor: pointer;
}

.ws-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--ws-primary-red);
    cursor: pointer;
}

.ws-forgot-password {
    color: var(--ws-primary-red);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s;
}

.ws-forgot-password:hover {
    color: var(--ws-primary-red-dark);
    text-decoration: underline;
}

/* Submit Button */
.ws-auth-submit-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    background: linear-gradient(135deg, var(--ws-primary-red) 0%, var(--ws-primary-red-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-full, 50px);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ws-auth-submit-btn:hover {
    background: linear-gradient(135deg, var(--ws-primary-red-dark) 0%, var(--mainsite-dark, #A33131) 100%);
    transform: translateY(-2px);
    box-shadow: var(--mainsite-shadow, 0 6px 20px rgba(229, 77, 77, 0.4));
}

.ws-auth-submit-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(229, 77, 77, 0.3));
}

.ws-auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ws-auth-submit-btn .btn-text {
    color: white;
}

.ws-auth-submit-btn .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: wsAuthSpin 0.8s linear infinite;
}

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

/* Divider */
.ws-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    color: var(--ws-text-gray);
    font-size: 0.8rem;
}

.ws-auth-divider::before,
.ws-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ws-border-light);
}

/* Social Login Buttons */
.ws-social-login-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ws-social-btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    background: var(--ws-bg-white);
    color: var(--ws-text-dark);
    border: 1px solid var(--ws-border-light);
    border-radius: var(--ws-radius);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ws-social-btn:hover {
    background: var(--ws-bg-light);
    border-color: var(--ws-text-gray);
}

.ws-social-btn svg {
    width: 20px;
    height: 20px;
}

/* Auth Message (Success/Error) */
.ws-auth-message {
    display: none;
    padding: 10px 14px;
    border-radius: var(--ws-radius);
    font-size: 0.85rem;
    margin-bottom: 14px;
    align-items: center;
    gap: 10px;
}

.ws-auth-message.visible {
    display: flex;
}

.ws-auth-message.success {
    background: var(--color-success-light, #D1FAE5);
    color: var(--color-success-dark, #065F46);
    border: 1px solid var(--phase-reflect-light, #6EE7B7);
}

.ws-auth-message.error {
    background: var(--color-error-light, #FEE2E2);
    color: var(--color-error-dark, #991B1B);
    border: 1px solid var(--phase-learn-light, #FCA5A5);
}

.ws-auth-message svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Terms Text */
.ws-terms-text {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--ws-text-gray);
    text-align: center;
    line-height: 1.5;
}

.ws-terms-text a {
    color: var(--ws-primary-red);
    font-weight: 500;
    text-decoration: none;
}

.ws-terms-text a:hover {
    color: var(--ws-primary-red-dark);
    text-decoration: underline;
}

/* Auth Switch Text */
.ws-auth-switch-text {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--ws-text-gray);
    text-align: center;
}

.ws-auth-switch-text a {
    color: var(--ws-primary-red);
    font-weight: 600;
    text-decoration: none;
}

.ws-auth-switch-text a:hover {
    color: var(--ws-primary-red-dark);
    text-decoration: underline;
}

/* Forgot Password Modal Styles */
.ws-forgot-instructions {
    font-size: 0.9rem;
    color: var(--ws-text-gray);
    margin-bottom: 20px;
    line-height: 1.5;
}

.ws-forgot-form-state .ws-form-group {
    margin-bottom: 16px;
}

.ws-forgot-form-state .ws-auth-submit-btn {
    margin-top: 16px;
}

.ws-forgot-success-state {
    text-align: center;
    padding: 20px 0;
}

.ws-forgot-success-state .success-icon-large {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: var(--color-success-light, #D1FAE5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ws-forgot-success-state .success-icon-large svg {
    width: 32px;
    height: 32px;
    color: var(--color-success-dark, #065F46);
}

.ws-forgot-success-state h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ws-text-dark);
    margin: 0 0 12px;
}

.ws-forgot-success-state p {
    font-size: 0.9rem;
    color: var(--ws-text-gray);
    margin: 0 0 12px;
    line-height: 1.5;
}

.ws-forgot-success-state p strong {
    color: var(--ws-text-dark);
}

.ws-forgot-note {
    font-size: 0.8rem !important;
    margin-bottom: 24px !important;
}

.ws-forgot-note a {
    color: var(--ws-primary-red);
    font-weight: 500;
    text-decoration: none;
}

.ws-forgot-note a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
    .ws-auth-modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: var(--radius-xl, 12px);
    }

    .ws-auth-body {
        padding: 12px 16px 14px;
    }

    .ws-auth-modal-header {
        padding: 16px;
    }

    .ws-form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
