/* Auth Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

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

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-light);
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    background: transparent;
    border: none;
    padding: 0;
}

.close:hover,
.close:active {
    background: var(--bg-alt);
    color: var(--text);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.auth-form {
    padding: 2rem;
}

.auth-form.hidden {
    display: none;
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.form-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-options input[type="checkbox"] {
    width: auto;
}

.form-options a {
    color: var(--primary);
    text-decoration: none;
}

.form-options a:hover {
    text-decoration: underline;
}

.submit-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: var(--primary-dark);
}

.submit-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

.submit-btn.secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.submit-btn.secondary:hover {
    background: var(--bg-alt);
}

.error-message {
    color: #dc2626;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
    display: none;
}

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

.terms {
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
    margin-top: 1rem;
}

.terms a {
    color: var(--primary);
}

/* User Dashboard */
#userInfo {
    background: var(--bg-alt);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

#userInfo p {
    margin: 0.5rem 0;
}

#userInfo strong {
    color: var(--text);
}

#orgInfo {
    background: #dbeafe;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

#orgInfo h3 {
    margin-top: 0;
    color: var(--primary);
}

.success-message {
    color: var(--success);
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
}

/* Wizard Styles */
.wizard-container {
    padding: 2rem;
}

.wizard-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.wizard-header h2 {
    margin: 0 0 0.5rem 0;
    color: var(--primary);
}

.wizard-subtitle {
    color: var(--text-light);
    margin: 0;
}

.wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.wizard-step-indicator {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    position: relative;
}

.wizard-step-indicator.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.wizard-step-indicator.completed {
    color: var(--success);
    border-bottom-color: var(--success);
}

.wizard-step {
    animation: fadeIn 0.3s ease;
}

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

.wizard-step h3 {
    margin: 0 0 1rem 0;
    color: var(--text);
}

.wizard-step > p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.wizard-info {
    background: var(--bg-alt);
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin: 1.5rem 0;
}

.wizard-info h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--text);
}

.wizard-info ul {
    margin: 0;
    padding-left: 1.25rem;
}

.wizard-info li {
    margin: 0.5rem 0;
    color: var(--text-light);
}

.wizard-form {
    margin-top: 1rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-label:hover {
    border-color: var(--primary);
    background: var(--bg-alt);
}

.radio-label input[type="radio"] {
    margin-top: 0.25rem;
}

.radio-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.wizard-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.wizard-actions .submit-btn {
    flex: 1;
}

.wizard-actions .submit-btn.secondary {
    flex: 0.5;
}

.invite-section {
    background: var(--bg-alt);
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
}

.invite-section p {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
}

.invite-link-box {
    display: flex;
    gap: 0.5rem;
}

.invite-link-box code {
    flex: 1;
    background: white;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    word-break: break-all;
    border: 1px solid var(--border);
}

.btn-small {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}

.btn-small:hover {
    background: var(--primary-dark);
}

.wizard-summary {
    background: var(--bg-alt);
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin: 1.5rem 0;
}

.wizard-summary p {
    margin: 0.5rem 0;
    color: var(--text);
}

.wizard-summary strong {
    color: var(--primary);
}

/* Mobile Responsive Styles */
@media (max-width: 640px) {
    .modal-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        margin: 0;
    }

    .auth-tabs {
        padding: 1rem;
    }

    .auth-form {
        padding: 1.5rem;
    }

    .auth-form h2 {
        font-size: 1.25rem;
    }

    .form-group input {
        padding: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .submit-btn {
        padding: 0.875rem;
        font-size: 1rem;
    }

    /* Wizard mobile styles */
    .wizard-container {
        padding: 1rem;
    }

    .wizard-header h2 {
        font-size: 1.25rem;
    }

    .wizard-progress {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .wizard-step-indicator {
        flex: 1 1 45%;
        font-size: 0.7rem;
        padding: 0.375rem;
    }

    .wizard-step h3 {
        font-size: 1.1rem;
    }

    .wizard-info {
        padding: 1rem;
    }

    .wizard-info li {
        font-size: 0.85rem;
    }

    .radio-label {
        padding: 0.75rem;
    }

    .radio-text {
        font-size: 0.85rem;
    }

    .radio-text strong {
        display: block;
        margin-bottom: 0.25rem;
    }

    .wizard-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .wizard-actions .submit-btn,
    .wizard-actions .submit-btn.secondary {
        flex: 1;
        width: 100%;
    }

    .invite-link-box {
        flex-direction: column;
    }

    .btn-small {
        width: 100%;
        padding: 0.75rem;
    }

    /* User dashboard mobile */
    #userInfo,
    #orgInfo {
        padding: 0.75rem;
    }

    #userInfo p,
    #orgInfo p {
        font-size: 0.9rem;
    }

    /* Form options mobile */
    .form-options {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}
